[gtk+/wip/chergert/quartz-frame-clock: 217/228] quartz: experiment to teach pixel cache about quartz CGLayer



commit ce2b236b168f27c138d94ad02c2ab2c3ac9e4e8d
Author: Christian Hergert <christian hergert me>
Date:   Thu Sep 10 03:00:38 2015 -0700

    quartz: experiment to teach pixel cache about quartz CGLayer
    
    We need a CGLayer for quartz to opportunistically cache the layer in the
    GPU. But we cant do this for everything, so be descriminate and use it in
    the pixel cache only.

 gtk/gtkpixelcache.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkpixelcache.c b/gtk/gtkpixelcache.c
index 6661f3d..e56fb03 100644
--- a/gtk/gtkpixelcache.c
+++ b/gtk/gtkpixelcache.c
@@ -18,9 +18,15 @@
 #include "config.h"
 
 #include "gtkdebug.h"
+#include "gtkstylecontextprivate.h"
 #include "gtkpixelcacheprivate.h"
 #include "gtkstylecontextprivate.h"
 
+#ifdef GDK_WINDOWING_QUARTZ
+# include <cairo/cairo-quartz.h>
+# include <gdk/quartz/gdkquartz.h>
+#endif
+
 #define BLOW_CACHE_TIMEOUT_SEC 20
 
 /* The extra size of the offscreen surface we allocate
@@ -243,6 +249,18 @@ _gtk_pixel_cache_create_surface_if_needed (GtkPixelCache         *cache,
       cache->surface =
         gdk_window_create_similar_surface (window, content,
                                            surface_w, surface_h);
+
+#ifdef GDK_WINDOWING_QUARTZ
+      if (GDK_IS_QUARTZ_WINDOW (window))
+        {
+          cairo_surface_t *base;
+
+          base = cache->surface;
+          cache->surface = cairo_quartz_surface_create_cg_layer (base, content, surface_w, surface_h);
+          cairo_surface_destroy (base);
+        }
+#endif
+
       rect.x = 0;
       rect.y = 0;
       rect.width = surface_w;


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