[gtk+] gdkwindow: Don't create a subsurface if we don't need to



commit d619a78aeb5198af30001bc715fc5d8b732d6420
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Jun 20 20:46:49 2014 -0400

    gdkwindow: Don't create a subsurface if we don't need to
    
    In the case we have a native window, we don't need to crop it to a
    non-native subrectangle, as abs_x / abs_y / width / height are all 0.

 gdk/gdkwindow.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 2853a30..7638a33 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -3004,11 +3004,18 @@ _gdk_window_ref_cairo_surface (GdkWindow *window)
 
   surface = get_window_surface (window);
 
-  return cairo_surface_create_for_rectangle (surface,
-                                             window->abs_x,
-                                             window->abs_y,
-                                             window->width,
-                                             window->height);
+  if (gdk_window_has_impl (window))
+    {
+      return surface;
+    }
+  else
+    {
+      return cairo_surface_create_for_rectangle (surface,
+                                                 window->abs_x,
+                                                 window->abs_y,
+                                                 window->width,
+                                                 window->height);
+    }
 }
 
 /**


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