quartz: Reset drawable on pattern callback info when gc is updated

This commit is contained in:
Kristian Rietveld 2010-10-21 21:15:09 +02:00
parent b0a17e5a37
commit dfd7e05123
2 changed files with 12 additions and 1 deletions

View File

@ -613,16 +613,19 @@ _gdk_quartz_gc_update_cg_context (GdkGC *gc,
} }
else else
{ {
struct PatternCallbackInfo *info;
if (!private->ts_pattern) if (!private->ts_pattern)
{ {
gfloat width, height; gfloat width, height;
gboolean is_colored = FALSE; gboolean is_colored = FALSE;
CGPatternCallbacks callbacks = { 0, NULL, NULL }; CGPatternCallbacks callbacks = { 0, NULL, NULL };
struct PatternCallbackInfo *info;
CGPoint phase; CGPoint phase;
GdkPixmapImplQuartz *pix_impl = NULL; GdkPixmapImplQuartz *pix_impl = NULL;
info = g_new (struct PatternCallbackInfo, 1); info = g_new (struct PatternCallbackInfo, 1);
private->ts_pattern_info = info;
/* Won't ref to avoid circular dependencies */ /* Won't ref to avoid circular dependencies */
info->drawable = drawable; info->drawable = drawable;
info->private_gc = private; info->private_gc = private;
@ -667,6 +670,13 @@ _gdk_quartz_gc_update_cg_context (GdkGC *gc,
is_colored, is_colored,
&callbacks); &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; baseSpace = (fill == GDK_STIPPLED) ? CGColorSpaceCreateWithName (kCGColorSpaceGenericRGB) : NULL;
patternSpace = CGColorSpaceCreatePattern (baseSpace); patternSpace = CGColorSpaceCreatePattern (baseSpace);

View File

@ -72,6 +72,7 @@ struct _GdkGCQuartz
CGFloat dash_phase; CGFloat dash_phase;
CGPatternRef ts_pattern; CGPatternRef ts_pattern;
void *ts_pattern_info;
guint is_window : 1; guint is_window : 1;
}; };