summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Hergert <christian@hergert.me>2015-09-30 18:39:00 -0700
committerChristian Hergert <christian@hergert.me>2015-09-30 18:39:00 -0700
commit67aef5f5427aa5bde6037642927cee9add69bfc3 (patch)
tree4312793c6c11185c25302a6a1eea5b9553fe1006
parentb1be2a70fd2655dbac6442d2efa10a413bb76c95 (diff)
downloadgtk+-wip/chergert/quartz-frame-clock.tar.gz
wip: pixelcache: ensure we use CGLayer on quartzwip/chergert/quartz-frame-clock
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()
-rw-r--r--gtk/gtkpixelcache.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gtk/gtkpixelcache.c b/gtk/gtkpixelcache.c
index dae40447a8..8cfed3d16e 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;