[gtk+/gtk-2-24] gdk_window_begin_paint_region() - always reuse the same surface



commit ad6271eca90e6139acd624209e10931d0dffbd73
Author: John Lindgren <john lindgren aol com>
Date:   Wed Dec 3 10:33:00 2014 +0000

    gdk_window_begin_paint_region() - always reuse the same surface
    
    When using the implicit paint pixmap, always draw to the same surface
    (the standard one for the pixmap) each time rather than creating a new
    one each time. This is both more effective and more natural.
    
    It also fixes a redraw issue on win32, where using multiple surfaces
    on the same HDC sometimes causes issues.  This seems to be due to
    leftover state on the HDC from previous surfaces.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=741060

 gdk/gdkwindow.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 386e85d..45fee34 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -2984,15 +2984,10 @@ gdk_window_begin_paint_region (GdkWindow       *window,
 
   if (implicit_paint)
     {
-      int width, height;
-
       paint->uses_implicit = TRUE;
       paint->pixmap = g_object_ref (implicit_paint->pixmap);
       paint->x_offset = -private->abs_x + implicit_paint->x_offset;
       paint->y_offset = -private->abs_y + implicit_paint->y_offset;
-
-      gdk_drawable_get_size (paint->pixmap, &width, &height);
-      paint->surface = _gdk_drawable_create_cairo_surface (paint->pixmap, width, height);
     }
   else
     {
@@ -3002,9 +2997,10 @@ gdk_window_begin_paint_region (GdkWindow       *window,
       paint->pixmap =
        gdk_pixmap_new (window,
                        MAX (clip_box.width, 1), MAX (clip_box.height, 1), -1);
-      paint->surface = _gdk_drawable_ref_cairo_surface (paint->pixmap);
     }
 
+  paint->surface = _gdk_drawable_ref_cairo_surface (paint->pixmap);
+
   if (paint->surface)
     cairo_surface_set_device_offset (paint->surface,
                                     -paint->x_offset, -paint->y_offset);


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