From dfd7e05123042ce087658124f335afb1567d923d Mon Sep 17 00:00:00 2001 From: Kristian Rietveld Date: Thu, 21 Oct 2010 21:15:09 +0200 Subject: [PATCH] quartz: Reset drawable on pattern callback info when gc is updated --- gdk/quartz/gdkgc-quartz.c | 12 +++++++++++- gdk/quartz/gdkprivate-quartz.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/gdk/quartz/gdkgc-quartz.c b/gdk/quartz/gdkgc-quartz.c index c43db8e857..8b60a02250 100644 --- a/gdk/quartz/gdkgc-quartz.c +++ b/gdk/quartz/gdkgc-quartz.c @@ -613,16 +613,19 @@ _gdk_quartz_gc_update_cg_context (GdkGC *gc, } else { + struct PatternCallbackInfo *info; + if (!private->ts_pattern) { gfloat width, height; gboolean is_colored = FALSE; CGPatternCallbacks callbacks = { 0, NULL, NULL }; - struct PatternCallbackInfo *info; CGPoint phase; GdkPixmapImplQuartz *pix_impl = NULL; info = g_new (struct PatternCallbackInfo, 1); + private->ts_pattern_info = info; + /* Won't ref to avoid circular dependencies */ info->drawable = drawable; info->private_gc = private; @@ -667,6 +670,13 @@ _gdk_quartz_gc_update_cg_context (GdkGC *gc, is_colored, &callbacks); } + else + info = (struct PatternCallbackInfo *)private->ts_pattern_info; + + /* Update drawable in the pattern callback info. Again, we + * won't ref to avoid circular dependencies. + */ + info->drawable = drawable; baseSpace = (fill == GDK_STIPPLED) ? CGColorSpaceCreateWithName (kCGColorSpaceGenericRGB) : NULL; patternSpace = CGColorSpaceCreatePattern (baseSpace); diff --git a/gdk/quartz/gdkprivate-quartz.h b/gdk/quartz/gdkprivate-quartz.h index 56379a96eb..1a2526eb25 100644 --- a/gdk/quartz/gdkprivate-quartz.h +++ b/gdk/quartz/gdkprivate-quartz.h @@ -72,6 +72,7 @@ struct _GdkGCQuartz CGFloat dash_phase; CGPatternRef ts_pattern; + void *ts_pattern_info; guint is_window : 1; };