[gtk+/wip/chergert/quartz-frame-clock: 138/138] wip: pixelcache: ensure we use CGLayer on quartz



commit 67aef5f5427aa5bde6037642927cee9add69bfc3
Author: Christian Hergert <christian hergert me>
Date:   Wed Sep 30 18:39:00 2015 -0700

    wip: pixelcache: ensure we use CGLayer on quartz
    
    This is a special case for quartz where we want to ensure that a
    CGLayer is used for the pixel cache. create_similar_surface() is not
    enough since only a few CGLayer backed surfaces seem possible
    before we can’t create them anymore.
    
    This requires cairo-quartz patches for
    cairo_quartz_surface_create_cg_layer()

 gtk/gtkpixelcache.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkpixelcache.c b/gtk/gtkpixelcache.c
index dae4044..8cfed3d 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]