Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | diff --git a/gfx/cairo/cairo/src/cairo-quartz-surface.c b/gfx/cairo/cairo/src/cairo-quartz-surface.c |
michael@0 | 2 | --- a/gfx/cairo/cairo/src/cairo-quartz-surface.c |
michael@0 | 3 | +++ b/gfx/cairo/cairo/src/cairo-quartz-surface.c |
michael@0 | 4 | @@ -128,20 +128,22 @@ CG_EXTERN CGImageRef CGBitmapContextCrea |
michael@0 | 5 | */ |
michael@0 | 6 | static void (*CGContextClipToMaskPtr) (CGContextRef, CGRect, CGImageRef) = NULL; |
michael@0 | 7 | static void (*CGContextDrawTiledImagePtr) (CGContextRef, CGRect, CGImageRef) = NULL; |
michael@0 | 8 | static unsigned int (*CGContextGetTypePtr) (CGContextRef) = NULL; |
michael@0 | 9 | static void (*CGContextSetShouldAntialiasFontsPtr) (CGContextRef, bool) = NULL; |
michael@0 | 10 | static void (*CGContextSetAllowsFontSmoothingPtr) (CGContextRef, bool) = NULL; |
michael@0 | 11 | static bool (*CGContextGetAllowsFontSmoothingPtr) (CGContextRef) = NULL; |
michael@0 | 12 | static CGPathRef (*CGContextCopyPathPtr) (CGContextRef) = NULL; |
michael@0 | 13 | static CGFloat (*CGContextGetAlphaPtr) (CGContextRef) = NULL; |
michael@0 | 14 | |
michael@0 | 15 | +static SInt32 _cairo_quartz_osx_version = 0x0; |
michael@0 | 16 | + |
michael@0 | 17 | static cairo_bool_t _cairo_quartz_symbol_lookup_done = FALSE; |
michael@0 | 18 | |
michael@0 | 19 | /* |
michael@0 | 20 | * Utility functions |
michael@0 | 21 | */ |
michael@0 | 22 | |
michael@0 | 23 | #ifdef QUARTZ_DEBUG |
michael@0 | 24 | static void quartz_surface_to_png (cairo_quartz_surface_t *nq, char *dest); |
michael@0 | 25 | static void quartz_image_to_png (CGImageRef, char *dest); |
michael@0 | 26 | #endif |
michael@0 | 27 | @@ -163,20 +165,25 @@ static void quartz_ensure_symbols(void) |
michael@0 | 28 | |
michael@0 | 29 | CGContextClipToMaskPtr = dlsym(RTLD_DEFAULT, "CGContextClipToMask"); |
michael@0 | 30 | CGContextDrawTiledImagePtr = dlsym(RTLD_DEFAULT, "CGContextDrawTiledImage"); |
michael@0 | 31 | CGContextGetTypePtr = dlsym(RTLD_DEFAULT, "CGContextGetType"); |
michael@0 | 32 | CGContextSetShouldAntialiasFontsPtr = dlsym(RTLD_DEFAULT, "CGContextSetShouldAntialiasFonts"); |
michael@0 | 33 | CGContextCopyPathPtr = dlsym(RTLD_DEFAULT, "CGContextCopyPath"); |
michael@0 | 34 | CGContextGetAllowsFontSmoothingPtr = dlsym(RTLD_DEFAULT, "CGContextGetAllowsFontSmoothing"); |
michael@0 | 35 | CGContextSetAllowsFontSmoothingPtr = dlsym(RTLD_DEFAULT, "CGContextSetAllowsFontSmoothing"); |
michael@0 | 36 | CGContextGetAlphaPtr = dlsym(RTLD_DEFAULT, "CGContextGetAlpha"); |
michael@0 | 37 | |
michael@0 | 38 | + if (Gestalt(gestaltSystemVersion, &_cairo_quartz_osx_version) != noErr) { |
michael@0 | 39 | + // assume 10.5 |
michael@0 | 40 | + _cairo_quartz_osx_version = 0x1050; |
michael@0 | 41 | + } |
michael@0 | 42 | + |
michael@0 | 43 | _cairo_quartz_symbol_lookup_done = TRUE; |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | CGImageRef |
michael@0 | 47 | _cairo_quartz_create_cgimage (cairo_format_t format, |
michael@0 | 48 | unsigned int width, |
michael@0 | 49 | unsigned int height, |
michael@0 | 50 | unsigned int stride, |
michael@0 | 51 | void *data, |
michael@0 | 52 | cairo_bool_t interpolate, |
michael@0 | 53 | @@ -3028,22 +3035,25 @@ static cairo_int_status_t |
michael@0 | 54 | CGContextSetAlpha (surface->cgContext, solid_mask->color.alpha); |
michael@0 | 55 | rv = _cairo_quartz_surface_paint_cg (surface, op, source, clip); |
michael@0 | 56 | CGContextSetAlpha (surface->cgContext, 1.0); |
michael@0 | 57 | |
michael@0 | 58 | return rv; |
michael@0 | 59 | } |
michael@0 | 60 | |
michael@0 | 61 | /* If we have CGContextClipToMask, we can do more complex masks */ |
michael@0 | 62 | if (CGContextClipToMaskPtr) { |
michael@0 | 63 | /* For these, we can skip creating a temporary surface, since we already have one */ |
michael@0 | 64 | - if (mask->type == CAIRO_PATTERN_TYPE_SURFACE && mask->extend == CAIRO_EXTEND_NONE) |
michael@0 | 65 | + /* For some reason this doesn't work reliably on OS X 10.5. See bug 721663. */ |
michael@0 | 66 | + if (_cairo_quartz_osx_version >= 0x1060 && mask->type == CAIRO_PATTERN_TYPE_SURFACE && |
michael@0 | 67 | + mask->extend == CAIRO_EXTEND_NONE) { |
michael@0 | 68 | return _cairo_quartz_surface_mask_with_surface (surface, op, source, (cairo_surface_pattern_t *) mask, clip); |
michael@0 | 69 | + } |
michael@0 | 70 | |
michael@0 | 71 | return _cairo_quartz_surface_mask_with_generic (surface, op, source, mask, clip); |
michael@0 | 72 | } |
michael@0 | 73 | |
michael@0 | 74 | /* So, CGContextClipToMask is not present in 10.3.9, so we're |
michael@0 | 75 | * doomed; if we have imageData, we can do fallback, otherwise |
michael@0 | 76 | * just pretend success. |
michael@0 | 77 | */ |
michael@0 | 78 | if (surface->imageData) |
michael@0 | 79 | return CAIRO_INT_STATUS_UNSUPPORTED; |