[gtk-vnc] Fix rendering artifacts when running in scaling mode



commit b4606754db60a1e832df8f12b269e153dd1f6a6a
Author: Daniel P. Berrange <berrange redhat com>
Date:   Thu Oct 28 11:34:09 2010 +0100

    Fix rendering artifacts when running in scaling mode
    
    The expose region was not large enough when running in scaling mode
    resulting in horizontal & vertical line artifacts when moving
    windows around on the virtual desktop. The previous fix used in
    Gtk2 was not sufficient for Gtk3, so change the fix to be entirely
    within the on_framebuffer_update handler
    
    * src/vncdisplay.c: Hack to fix rendering artifacts

 src/vncdisplay.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/src/vncdisplay.c b/src/vncdisplay.c
index bdf26da..55fbcf4 100644
--- a/src/vncdisplay.c
+++ b/src/vncdisplay.c
@@ -352,10 +352,10 @@ static gboolean expose_event(GtkWidget *widget, GdkEventExpose *expose)
 
 	cr = gdk_cairo_create(gtk_widget_get_window(GTK_WIDGET(obj)));
 	cairo_rectangle(cr,
-			expose->area.x-1,
-			expose->area.y-1,
-			expose->area.width + 2,
-			expose->area.height + 2);
+			expose->area.x,
+			expose->area.y,
+			expose->area.width,
+			expose->area.height);
 	cairo_clip(cr);
 
 	ret = draw_event(widget, cr);
@@ -852,10 +852,20 @@ static void on_framebuffer_update(VncConnection *conn G_GNUC_UNUSED,
 
 		sx = (double)ww / (double)fbw;
 		sy = (double)wh / (double)fbh;
+
 		x *= sx;
 		y *= sy;
 		w *= sx;
 		h *= sy;
+
+		/* Without this, we get horizontal & vertical line artifacts
+		 * when drawing. This "fix" is somewhat dubious though. The
+		 * true mistake & fix almost certainly lies elsewhere.
+		 */
+		x -= 2;
+		y -= 2;
+		w += 4;
+		h += 4;
 	} else {
 		int mw = 0, mh = 0;
 
@@ -870,7 +880,7 @@ static void on_framebuffer_update(VncConnection *conn G_GNUC_UNUSED,
 		y += mh;
 	}
 
-	gtk_widget_queue_draw_area(widget, x, y, w + 1, h + 1);
+	gtk_widget_queue_draw_area(widget, x, y, w, h);
 
 	vnc_connection_framebuffer_update_request(priv->conn, 1,
 						  0, 0,



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