[gtk+] Avoid unnecessary window flushes



commit 04811d948392f489b1febabe973337fcfa53c918
Author: Alexander Larsson <alexl redhat com>
Date:   Wed Aug 22 17:01:15 2012 +0200

    Avoid unnecessary window flushes
    
    The code was calling _gdk_window_ref_cairo_surface in a few places
    where the intent was not to read/write to the surface, but just look
    at its type (to e.g. create a similar surface). This is bad, as that
    operation causes a flush which may cause unnecessary work and/or
    flashing. Instead we just get the impl surface in these cases.

 gdk/gdkwindow.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 978eaa6..2a807ce 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -254,6 +254,7 @@ static void gdk_window_invalidate_rect_full (GdkWindow          *window,
 					     gboolean            invalidate_children,
 					     ClearBg             clear_bg);
 static void _gdk_window_propagate_has_alpha_background (GdkWindow *window);
+static cairo_surface_t *gdk_window_ref_impl_surface (GdkWindow *window);
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
@@ -2671,7 +2672,7 @@ gdk_window_get_content (GdkWindow *window)
 
   g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
 
-  surface = _gdk_window_ref_cairo_surface (window);
+  surface = gdk_window_ref_impl_surface (window);
   content = cairo_surface_get_content (surface);
   cairo_surface_destroy (surface);
 
@@ -10129,7 +10130,7 @@ gdk_window_create_similar_surface (GdkWindow *     window,
 
   g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
   
-  window_surface = _gdk_window_ref_cairo_surface (window);
+  window_surface = gdk_window_ref_impl_surface (window);
 
   switch (_gdk_rendering_mode)
   {



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