[PATCH spice-gtk] spice-widget: Fix invalidate region in case of image is scaled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 src/spice-widget.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/spice-widget.c b/src/spice-widget.c
index d73e02f2..9d6899c0 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);
-- 
2.21.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]