[Spice-commits] gtk/spice-widget-cairo.c
Alexander Larsson
alexl at kemper.freedesktop.org
Fri Aug 31 01:41:49 PDT 2012
gtk/spice-widget-cairo.c | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
New commits:
commit c34395247328528d5ad4d3994691ad642e3fe189
Author: Alexander Larsson <alexl at redhat.com>
Date: Fri Aug 31 09:47:50 2012 +0200
Fix flickering regression on some systems
For some reason the way we remove the "inner" area
when clearing the background doesn't work on one computer.
I don't really know why, but the current approach does seems a
little fragile.
This replaces it with a solid region operation that works on
all my machines.
https://bugs.freedesktop.org/show_bug.cgi?id=54277
diff --git a/gtk/spice-widget-cairo.c b/gtk/spice-widget-cairo.c
index 069410a..b457f89 100644
--- a/gtk/spice-widget-cairo.c
+++ b/gtk/spice-widget-cairo.c
@@ -77,6 +77,8 @@ G_GNUC_INTERNAL
void spicex_draw_event(SpiceDisplay *display, cairo_t *cr)
{
SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
+ cairo_rectangle_int_t rect;
+ cairo_region_t *region;
double s;
int x, y;
int ww, wh;
@@ -87,16 +89,25 @@ void spicex_draw_event(SpiceDisplay *display, cairo_t *cr)
gdk_drawable_get_size(gtk_widget_get_window(GTK_WIDGET(display)), &ww, &wh);
/* We need to paint the bg color around the image */
- cairo_rectangle(cr, 0, 0, ww, wh);
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = ww;
+ rect.height = wh;
+ region = cairo_region_create_rectangle(&rect);
/* Optionally cut out the inner area where the pixmap
will be drawn. This avoids 'flashing' since we're
- not double-buffering. Note we're using the undocumented
- behaviour of drawing the rectangle from right to left
- to cut out the whole */
- if (d->ximage)
- cairo_rectangle(cr, x + w, y,
- -w, h);
+ not double-buffering. */
+ if (d->ximage) {
+ rect.x = x;
+ rect.y = y;
+ rect.width = w;
+ rect.height = h;
+ cairo_region_subtract_rectangle(region, &rect);
+ }
+
+ gdk_cairo_region (cr, region);
+ cairo_region_destroy (region);
/* Need to set a real solid color, because the default is usually
transparent these days, and non-double buffered windows can't
More information about the Spice-commits
mailing list