[Spice-commits] src/spice-widget.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Oct 14 12:16:58 UTC 2019


 src/spice-widget.c |    8 ++++++++
 1 file changed, 8 insertions(+)

New commits:
commit 33ca9d412c4b4498faeb32736ea44d3188bff3ef
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Mon Oct 14 11:54:28 2019 +0100

    spice-widget: Fix invalidate region in case of image is scaled
    
    In case the drawing on the screen is scaled the scaling required to
    invalidate a slightly bigger region.
    This is due to the interpolation done during the resize.
    So if scaling is performed invalidate also the adjacent pixels.
    
    This fixes https://gitlab.freedesktop.org/spice/spice-gtk/issues/19.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/src/spice-widget.c b/src/spice-widget.c
index d73e02f..9d6899c 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -2847,6 +2847,14 @@ static void invalidate(SpiceChannel *channel,
                               &display_x, &display_y,
                               NULL, NULL);
 
+    gint scale_factor = gtk_widget_get_scale_factor(GTK_WIDGET(display));
+    if (s * scale_factor > 1) {
+        rect.x -= 1;
+        rect.y -= 1;
+        rect.width += 2;
+        rect.height += 2;
+    }
+
     x1 = floor ((rect.x - d->area.x) * s);
     y1 = floor ((rect.y - d->area.y) * s);
     x2 = ceil ((rect.x - d->area.x + rect.width) * s);


More information about the Spice-commits mailing list