[gtk+] PixelCache: Ensure clean cairo_t state in draw



commit d07913840aca3ba3ef2cd046082f49da7fca39d7
Author: Alexander Larsson <alexl redhat com>
Date:   Wed Jan 8 10:44:32 2014 +0100

    PixelCache: Ensure clean cairo_t state in draw
    
    This adds save/restore calls to the clear-to-transparent call in
    the pixel cache, to avoid changing the default color of the
    cairo_t. It also removes a call set_operator call that is no longer
    necessary (it was trying to manually restore the state).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=721480

 gtk/gtkpixelcache.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkpixelcache.c b/gtk/gtkpixelcache.c
index 411a75e..71c7833 100644
--- a/gtk/gtkpixelcache.c
+++ b/gtk/gtkpixelcache.c
@@ -340,12 +340,13 @@ _gtk_pixel_cache_repaint (GtkPixelCache *cache,
       cairo_translate (backing_cr,
                       -cache->surface_x - canvas_rect->x - view_rect->x,
                       -cache->surface_y - canvas_rect->y - view_rect->y);
+
+      cairo_save (backing_cr);
       cairo_set_source_rgba (backing_cr,
                             0.0, 0, 0, 0.0);
       cairo_set_operator (backing_cr, CAIRO_OPERATOR_SOURCE);
       cairo_paint (backing_cr);
-
-      cairo_set_operator (backing_cr, CAIRO_OPERATOR_OVER);
+      cairo_restore (backing_cr);
 
       cairo_save (backing_cr);
       draw (backing_cr, user_data);


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