michael@0: diff --git a/gfx/cairo/cairo/src/cairo-quartz-surface.c b/gfx/cairo/cairo/src/cairo-quartz-surface.c michael@0: --- a/gfx/cairo/cairo/src/cairo-quartz-surface.c michael@0: +++ b/gfx/cairo/cairo/src/cairo-quartz-surface.c michael@0: @@ -128,20 +128,22 @@ CG_EXTERN CGImageRef CGBitmapContextCrea michael@0: */ michael@0: static void (*CGContextClipToMaskPtr) (CGContextRef, CGRect, CGImageRef) = NULL; michael@0: static void (*CGContextDrawTiledImagePtr) (CGContextRef, CGRect, CGImageRef) = NULL; michael@0: static unsigned int (*CGContextGetTypePtr) (CGContextRef) = NULL; michael@0: static void (*CGContextSetShouldAntialiasFontsPtr) (CGContextRef, bool) = NULL; michael@0: static void (*CGContextSetAllowsFontSmoothingPtr) (CGContextRef, bool) = NULL; michael@0: static bool (*CGContextGetAllowsFontSmoothingPtr) (CGContextRef) = NULL; michael@0: static CGPathRef (*CGContextCopyPathPtr) (CGContextRef) = NULL; michael@0: static CGFloat (*CGContextGetAlphaPtr) (CGContextRef) = NULL; michael@0: michael@0: +static SInt32 _cairo_quartz_osx_version = 0x0; michael@0: + michael@0: static cairo_bool_t _cairo_quartz_symbol_lookup_done = FALSE; michael@0: michael@0: /* michael@0: * Utility functions michael@0: */ michael@0: michael@0: #ifdef QUARTZ_DEBUG michael@0: static void quartz_surface_to_png (cairo_quartz_surface_t *nq, char *dest); michael@0: static void quartz_image_to_png (CGImageRef, char *dest); michael@0: #endif michael@0: @@ -163,20 +165,25 @@ static void quartz_ensure_symbols(void) michael@0: michael@0: CGContextClipToMaskPtr = dlsym(RTLD_DEFAULT, "CGContextClipToMask"); michael@0: CGContextDrawTiledImagePtr = dlsym(RTLD_DEFAULT, "CGContextDrawTiledImage"); michael@0: CGContextGetTypePtr = dlsym(RTLD_DEFAULT, "CGContextGetType"); michael@0: CGContextSetShouldAntialiasFontsPtr = dlsym(RTLD_DEFAULT, "CGContextSetShouldAntialiasFonts"); michael@0: CGContextCopyPathPtr = dlsym(RTLD_DEFAULT, "CGContextCopyPath"); michael@0: CGContextGetAllowsFontSmoothingPtr = dlsym(RTLD_DEFAULT, "CGContextGetAllowsFontSmoothing"); michael@0: CGContextSetAllowsFontSmoothingPtr = dlsym(RTLD_DEFAULT, "CGContextSetAllowsFontSmoothing"); michael@0: CGContextGetAlphaPtr = dlsym(RTLD_DEFAULT, "CGContextGetAlpha"); michael@0: michael@0: + if (Gestalt(gestaltSystemVersion, &_cairo_quartz_osx_version) != noErr) { michael@0: + // assume 10.5 michael@0: + _cairo_quartz_osx_version = 0x1050; michael@0: + } michael@0: + michael@0: _cairo_quartz_symbol_lookup_done = TRUE; michael@0: } michael@0: michael@0: CGImageRef michael@0: _cairo_quartz_create_cgimage (cairo_format_t format, michael@0: unsigned int width, michael@0: unsigned int height, michael@0: unsigned int stride, michael@0: void *data, michael@0: cairo_bool_t interpolate, michael@0: @@ -3028,22 +3035,25 @@ static cairo_int_status_t michael@0: CGContextSetAlpha (surface->cgContext, solid_mask->color.alpha); michael@0: rv = _cairo_quartz_surface_paint_cg (surface, op, source, clip); michael@0: CGContextSetAlpha (surface->cgContext, 1.0); michael@0: michael@0: return rv; michael@0: } michael@0: michael@0: /* If we have CGContextClipToMask, we can do more complex masks */ michael@0: if (CGContextClipToMaskPtr) { michael@0: /* For these, we can skip creating a temporary surface, since we already have one */ michael@0: - if (mask->type == CAIRO_PATTERN_TYPE_SURFACE && mask->extend == CAIRO_EXTEND_NONE) michael@0: + /* For some reason this doesn't work reliably on OS X 10.5. See bug 721663. */ michael@0: + if (_cairo_quartz_osx_version >= 0x1060 && mask->type == CAIRO_PATTERN_TYPE_SURFACE && michael@0: + mask->extend == CAIRO_EXTEND_NONE) { michael@0: return _cairo_quartz_surface_mask_with_surface (surface, op, source, (cairo_surface_pattern_t *) mask, clip); michael@0: + } michael@0: michael@0: return _cairo_quartz_surface_mask_with_generic (surface, op, source, mask, clip); michael@0: } michael@0: michael@0: /* So, CGContextClipToMask is not present in 10.3.9, so we're michael@0: * doomed; if we have imageData, we can do fallback, otherwise michael@0: * just pretend success. michael@0: */ michael@0: if (surface->imageData) michael@0: return CAIRO_INT_STATUS_UNSUPPORTED;