[cairo-commit] 3 commits - src/cairo-quartz-surface.c test/extended-blend-alpha.quartz.argb32.ref.png test/extended-blend-alpha.quartz.rgb24.ref.png test/extended-blend.quartz.argb32.ref.png test/extended-blend.quartz.rgb24.ref.png test/Makefile.am
Andrea Canciani
ranma42 at kemper.freedesktop.org
Sat Jan 1 03:55:50 PST 2011
src/cairo-quartz-surface.c | 304 ++++++++++++------------
test/Makefile.am | 4
test/extended-blend-alpha.quartz.argb32.ref.png |binary
test/extended-blend-alpha.quartz.rgb24.ref.png |binary
test/extended-blend.quartz.argb32.ref.png |binary
test/extended-blend.quartz.rgb24.ref.png |binary
6 files changed, 157 insertions(+), 151 deletions(-)
New commits:
commit 8f598dd69d3f98da8a59cbd87640aedf22473290
Author: Andrea Canciani <ranma42 at gmail.com>
Date: Fri Jul 23 08:20:52 2010 +0200
quartz: Use native PDF blend modes
Quartz supports PDF blend modes since 10.4 and exposes Porter-Duff
compositing operators through the public API since 10.5.
diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index 32d0d47..c5fbe03 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -77,6 +77,7 @@
* This macro can be used to conditionally compile backend-specific code.
*/
+#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1050
/* This method is private, but it exists. Its params are are exposed
* as args to the NS* method, but not as CG.
*/
@@ -97,6 +98,7 @@ enum PrivateCGCompositeMode {
};
typedef enum PrivateCGCompositeMode PrivateCGCompositeMode;
CG_EXTERN void CGContextSetCompositeOperation (CGContextRef, PrivateCGCompositeMode);
+#endif
CG_EXTERN void CGContextSetCTM (CGContextRef, CGAffineTransform);
/* Some of these are present in earlier versions of the OS than where
@@ -356,6 +358,7 @@ _cairo_quartz_cairo_path_to_quartz_context (cairo_path_fixed_t *path,
* Misc helpers/callbacks
*/
+#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1050
static PrivateCGCompositeMode
_cairo_quartz_cairo_operator_to_quartz_composite (cairo_operator_t op)
{
@@ -403,114 +406,149 @@ _cairo_quartz_cairo_operator_to_quartz_composite (cairo_operator_t op)
case CAIRO_OPERATOR_HSL_COLOR:
case CAIRO_OPERATOR_HSL_LUMINOSITY:
default:
- assert (0);
+ ASSERT_NOT_REACHED;
}
}
+#endif
-static cairo_int_status_t
-_cairo_quartz_surface_set_cairo_operator (cairo_quartz_surface_t *surface, cairo_operator_t op)
+static CGBlendMode
+_cairo_quartz_cairo_operator_to_quartz_blend (cairo_operator_t op)
{
- ND ((stderr, "%p _cairo_quartz_surface_set_cairo_operator %d\n", surface, op));
-
- if (surface->base.content == CAIRO_CONTENT_ALPHA) {
- /* For some weird reason, some compositing operators are
- swapped when operating on masks */
- switch (op) {
- case CAIRO_OPERATOR_CLEAR:
- case CAIRO_OPERATOR_SOURCE:
- case CAIRO_OPERATOR_OVER:
- case CAIRO_OPERATOR_DEST_IN:
- case CAIRO_OPERATOR_DEST_OUT:
- case CAIRO_OPERATOR_ADD:
- CGContextSetCompositeOperation (surface->cgContext, _cairo_quartz_cairo_operator_to_quartz_composite (op));
- return CAIRO_STATUS_SUCCESS;
+ switch (op) {
+ case CAIRO_OPERATOR_MULTIPLY:
+ return kCGBlendModeMultiply;
+ case CAIRO_OPERATOR_SCREEN:
+ return kCGBlendModeScreen;
+ case CAIRO_OPERATOR_OVERLAY:
+ return kCGBlendModeOverlay;
+ case CAIRO_OPERATOR_DARKEN:
+ return kCGBlendModeDarken;
+ case CAIRO_OPERATOR_LIGHTEN:
+ return kCGBlendModeLighten;
+ case CAIRO_OPERATOR_COLOR_DODGE:
+ return kCGBlendModeColorDodge;
+ case CAIRO_OPERATOR_COLOR_BURN:
+ return kCGBlendModeColorBurn;
+ case CAIRO_OPERATOR_HARD_LIGHT:
+ return kCGBlendModeHardLight;
+ case CAIRO_OPERATOR_SOFT_LIGHT:
+ return kCGBlendModeSoftLight;
+ case CAIRO_OPERATOR_DIFFERENCE:
+ return kCGBlendModeDifference;
+ case CAIRO_OPERATOR_EXCLUSION:
+ return kCGBlendModeExclusion;
+ case CAIRO_OPERATOR_HSL_HUE:
+ return kCGBlendModeHue;
+ case CAIRO_OPERATOR_HSL_SATURATION:
+ return kCGBlendModeSaturation;
+ case CAIRO_OPERATOR_HSL_COLOR:
+ return kCGBlendModeColor;
+ case CAIRO_OPERATOR_HSL_LUMINOSITY:
+ return kCGBlendModeLuminosity;
- case CAIRO_OPERATOR_IN:
- CGContextSetCompositeOperation (surface->cgContext, kPrivateCGCompositeDestinationAtop);
- return CAIRO_STATUS_SUCCESS;
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
+ case CAIRO_OPERATOR_CLEAR:
+ return kCGBlendModeClear;
+ case CAIRO_OPERATOR_SOURCE:
+ return kCGBlendModeCopy;
+ case CAIRO_OPERATOR_OVER:
+ return kCGBlendModeNormal;
+ case CAIRO_OPERATOR_IN:
+ return kCGBlendModeSourceIn;
+ case CAIRO_OPERATOR_OUT:
+ return kCGBlendModeSourceOut;
+ case CAIRO_OPERATOR_ATOP:
+ return kCGBlendModeSourceAtop;
+ case CAIRO_OPERATOR_DEST_OVER:
+ return kCGBlendModeDestinationOver;
+ case CAIRO_OPERATOR_DEST_IN:
+ return kCGBlendModeDestinationIn;
+ case CAIRO_OPERATOR_DEST_OUT:
+ return kCGBlendModeDestinationOut;
+ case CAIRO_OPERATOR_DEST_ATOP:
+ return kCGBlendModeDestinationAtop;
+ case CAIRO_OPERATOR_XOR:
+ return kCGBlendModeXOR;
+ case CAIRO_OPERATOR_ADD:
+ return kCGBlendModePlusLighter;
+#else
+ case CAIRO_OPERATOR_CLEAR:
+ case CAIRO_OPERATOR_SOURCE:
+ case CAIRO_OPERATOR_OVER:
+ case CAIRO_OPERATOR_IN:
+ case CAIRO_OPERATOR_OUT:
+ case CAIRO_OPERATOR_ATOP:
+ case CAIRO_OPERATOR_DEST_OVER:
+ case CAIRO_OPERATOR_DEST_IN:
+ case CAIRO_OPERATOR_DEST_OUT:
+ case CAIRO_OPERATOR_DEST_ATOP:
+ case CAIRO_OPERATOR_XOR:
+ case CAIRO_OPERATOR_ADD:
+#endif
- case CAIRO_OPERATOR_DEST_OVER:
- case CAIRO_OPERATOR_MULTIPLY:
- case CAIRO_OPERATOR_SCREEN:
- case CAIRO_OPERATOR_OVERLAY:
- case CAIRO_OPERATOR_DARKEN:
- case CAIRO_OPERATOR_LIGHTEN:
- case CAIRO_OPERATOR_COLOR_DODGE:
- case CAIRO_OPERATOR_COLOR_BURN:
- case CAIRO_OPERATOR_HARD_LIGHT:
- case CAIRO_OPERATOR_SOFT_LIGHT:
- case CAIRO_OPERATOR_DIFFERENCE:
- case CAIRO_OPERATOR_EXCLUSION:
- case CAIRO_OPERATOR_HSL_HUE:
- case CAIRO_OPERATOR_HSL_SATURATION:
- case CAIRO_OPERATOR_HSL_COLOR:
- case CAIRO_OPERATOR_HSL_LUMINOSITY:
- CGContextSetCompositeOperation (surface->cgContext, kPrivateCGCompositeSourceOver);
- return CAIRO_STATUS_SUCCESS;
+ case CAIRO_OPERATOR_DEST:
+ case CAIRO_OPERATOR_SATURATE:
+ default:
+ ASSERT_NOT_REACHED;
+ }
+}
- case CAIRO_OPERATOR_DEST_ATOP:
- CGContextSetCompositeOperation (surface->cgContext, kPrivateCGCompositeSourceIn);
- return CAIRO_STATUS_SUCCESS;
+static cairo_int_status_t
+_cairo_cgcontext_set_cairo_operator (CGContextRef context, cairo_operator_t op)
+{
+ CGBlendMode blendmode;
- case CAIRO_OPERATOR_SATURATE:
- CGContextSetCompositeOperation (surface->cgContext, kPrivateCGCompositePlusLighter);
- return CAIRO_STATUS_SUCCESS;
+ if (op == CAIRO_OPERATOR_DEST)
+ return CAIRO_INT_STATUS_NOTHING_TO_DO;
+ /* Quartz doesn't support SATURATE at all. COLOR_DODGE and
+ * COLOR_BURN in Quartz follow the ISO32000 definition, but cairo
+ * uses the definition from the Adobe Supplement.
+ */
+ if (op == CAIRO_OPERATOR_SATURATE ||
+ op == CAIRO_OPERATOR_COLOR_DODGE ||
+ op == CAIRO_OPERATOR_COLOR_BURN)
+ {
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+ }
- case CAIRO_OPERATOR_ATOP:
- /*
- CGContextSetCompositeOperation (surface->cgContext, kPrivateCGCompositeDestinationOver);
- return CAIRO_STATUS_SUCCESS;
- */
- case CAIRO_OPERATOR_DEST:
- return CAIRO_INT_STATUS_NOTHING_TO_DO;
-
- case CAIRO_OPERATOR_OUT:
- case CAIRO_OPERATOR_XOR:
- default:
- return CAIRO_INT_STATUS_UNSUPPORTED;
- }
- } else {
- switch (op) {
- case CAIRO_OPERATOR_CLEAR:
- case CAIRO_OPERATOR_SOURCE:
- case CAIRO_OPERATOR_OVER:
- case CAIRO_OPERATOR_IN:
- case CAIRO_OPERATOR_OUT:
- case CAIRO_OPERATOR_ATOP:
- case CAIRO_OPERATOR_DEST_OVER:
- case CAIRO_OPERATOR_DEST_IN:
- case CAIRO_OPERATOR_DEST_OUT:
- case CAIRO_OPERATOR_DEST_ATOP:
- case CAIRO_OPERATOR_XOR:
- case CAIRO_OPERATOR_ADD:
- CGContextSetCompositeOperation (surface->cgContext, _cairo_quartz_cairo_operator_to_quartz_composite (op));
- return CAIRO_STATUS_SUCCESS;
+#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+ if (op <= CAIRO_OPERATOR_ADD) {
+ PrivateCGCompositeMode compmode;
- case CAIRO_OPERATOR_DEST:
- return CAIRO_INT_STATUS_NOTHING_TO_DO;
-
- case CAIRO_OPERATOR_SATURATE:
- /* TODO: the following are mostly supported by CGContextSetBlendMode*/
- case CAIRO_OPERATOR_MULTIPLY:
- case CAIRO_OPERATOR_SCREEN:
- case CAIRO_OPERATOR_OVERLAY:
- case CAIRO_OPERATOR_DARKEN:
- case CAIRO_OPERATOR_LIGHTEN:
- case CAIRO_OPERATOR_COLOR_DODGE:
- case CAIRO_OPERATOR_COLOR_BURN:
- case CAIRO_OPERATOR_HARD_LIGHT:
- case CAIRO_OPERATOR_SOFT_LIGHT:
- case CAIRO_OPERATOR_DIFFERENCE:
- case CAIRO_OPERATOR_EXCLUSION:
- case CAIRO_OPERATOR_HSL_HUE:
- case CAIRO_OPERATOR_HSL_SATURATION:
- case CAIRO_OPERATOR_HSL_COLOR:
- case CAIRO_OPERATOR_HSL_LUMINOSITY:
- default:
- return CAIRO_INT_STATUS_UNSUPPORTED;
- }
+ compmode = _cairo_quartz_cairo_operator_to_quartz_composite (op);
+ CGContextSetCompositeOperation (context, compmode);
+ return CAIRO_STATUS_SUCCESS;
}
+#endif
+
+ blendmode = _cairo_quartz_cairo_operator_to_quartz_blend (op);
+ CGContextSetBlendMode (context, blendmode);
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static cairo_int_status_t
+_cairo_quartz_surface_set_cairo_operator (cairo_quartz_surface_t *surface, cairo_operator_t op)
+{
+ ND((stderr, "%p _cairo_quartz_surface_set_cairo_operator %d\n", surface, op));
+
+ if (surface->base.content == CAIRO_CONTENT_ALPHA) {
+ if (op == CAIRO_OPERATOR_OUT ||
+ op == CAIRO_OPERATOR_XOR)
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+ else if (op == CAIRO_OPERATOR_SATURATE)
+ op = CAIRO_OPERATOR_ADD;
+ else if (op == CAIRO_OPERATOR_IN)
+ op = CAIRO_OPERATOR_DEST_ATOP;
+ else if (op == CAIRO_OPERATOR_DEST_ATOP)
+ op = CAIRO_OPERATOR_IN;
+ else if (op == CAIRO_OPERATOR_ATOP)
+ return CAIRO_INT_STATUS_NOTHING_TO_DO; /* op = CAIRO_OPERATOR_DEST_OVER */
+ else if (op == CAIRO_OPERATOR_DEST_OVER)
+ op = CAIRO_OPERATOR_ATOP;
+ }
+
+ return _cairo_cgcontext_set_cairo_operator (surface->cgContext, op);
}
static inline CGLineCap
@@ -641,14 +679,15 @@ _cairo_quartz_fixup_unbounded_operation (cairo_quartz_surface_t *surface,
if (!cgc)
return;
- CGContextSetCompositeOperation (cgc, kPrivateCGCompositeCopy);
+ _cairo_cgcontext_set_cairo_operator (cgc, CAIRO_OPERATOR_SOURCE);
+
/* We want to mask out whatever we just rendered, so we fill the
* surface opaque, and then we'll render transparent.
*/
CGContextSetAlpha (cgc, 1.0f);
CGContextFillRect (cgc, CGRectMake (0, 0, clipBoxRound.size.width, clipBoxRound.size.height));
- CGContextSetCompositeOperation (cgc, kPrivateCGCompositeClear);
+ _cairo_cgcontext_set_cairo_operator (cgc, CAIRO_OPERATOR_CLEAR);
CGContextSetShouldAntialias (cgc, (antialias != CAIRO_ANTIALIAS_NONE));
CGContextTranslateCTM (cgc, -clipBoxRound.origin.x, -clipBoxRound.origin.y);
@@ -719,7 +758,7 @@ _cairo_quartz_fixup_unbounded_operation (cairo_quartz_surface_t *surface,
/* Then render with the mask */
CGContextSaveGState (surface->cgContext);
- CGContextSetCompositeOperation (surface->cgContext, kPrivateCGCompositeCopy);
+ _cairo_quartz_surface_set_cairo_operator (surface, CAIRO_OPERATOR_SOURCE);
CGContextClipToMask (surface->cgContext, clipBoxRound, maskImage);
CGImageRelease (maskImage);
@@ -1663,8 +1702,7 @@ _cairo_quartz_surface_clone_similar (void *abstract_surface,
CGContextSaveGState (new_surface->cgContext);
- CGContextSetCompositeOperation (new_surface->cgContext,
- kPrivateCGCompositeCopy);
+ _cairo_quartz_surface_set_cairo_operator (new_surface, CAIRO_OPERATOR_SOURCE);
CGContextTranslateCTM (new_surface->cgContext, -src_x, -src_y);
CGContextDrawImage (new_surface->cgContext,
diff --git a/test/Makefile.am b/test/Makefile.am
index aa203bc..236fc4f 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -483,11 +483,15 @@ REFERENCE_IMAGES = \
extended-blend.image16.ref.png \
extended-blend.argb32.ref.png \
extended-blend.rgb24.ref.png \
+ extended-blend.quartz.argb32.ref.png \
+ extended-blend.quartz.rgb24.ref.png \
extended-blend.svg12.argb32.xfail.png \
extended-blend.svg12.rgb24.xfail.png \
extended-blend-alpha.image16.ref.png \
extended-blend-alpha.argb32.ref.png \
extended-blend-alpha.rgb24.ref.png \
+ extended-blend-alpha.quartz.argb32.ref.png \
+ extended-blend-alpha.quartz.rgb24.ref.png \
extended-blend-alpha.svg12.argb32.xfail.png \
extended-blend-alpha.svg12.rgb24.xfail.png \
extend-pad-border.image16.ref.png \
diff --git a/test/extended-blend-alpha.quartz.argb32.ref.png b/test/extended-blend-alpha.quartz.argb32.ref.png
new file mode 100644
index 0000000..e5701a6
Binary files /dev/null and b/test/extended-blend-alpha.quartz.argb32.ref.png differ
diff --git a/test/extended-blend-alpha.quartz.rgb24.ref.png b/test/extended-blend-alpha.quartz.rgb24.ref.png
new file mode 100644
index 0000000..477d346
Binary files /dev/null and b/test/extended-blend-alpha.quartz.rgb24.ref.png differ
diff --git a/test/extended-blend.quartz.argb32.ref.png b/test/extended-blend.quartz.argb32.ref.png
new file mode 100644
index 0000000..173c6e2
Binary files /dev/null and b/test/extended-blend.quartz.argb32.ref.png differ
diff --git a/test/extended-blend.quartz.rgb24.ref.png b/test/extended-blend.quartz.rgb24.ref.png
new file mode 100644
index 0000000..56a1214
Binary files /dev/null and b/test/extended-blend.quartz.rgb24.ref.png differ
commit fabbc16253c68234b881af25abf734ba786d234f
Author: Andrea Canciani <ranma42 at gmail.com>
Date: Thu Dec 30 19:32:30 2010 +0100
quartz: Don't dynamically load unused functions
Remove an unused variable.
diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index 9a59382..32d0d47 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -111,7 +111,6 @@ static void (*CGContextSetAllowsFontSmoothingPtr) (CGContextRef, bool) = NULL;
/* not yet public */
static unsigned int (*CGContextGetTypePtr) (CGContextRef) = NULL;
-static void (*CGContextSetShouldAntialiasFontsPtr) (CGContextRef, bool) = NULL;
static bool (*CGContextGetAllowsFontSmoothingPtr) (CGContextRef) = NULL;
static cairo_bool_t _cairo_quartz_symbol_lookup_done = FALSE;
@@ -142,7 +141,6 @@ static void quartz_ensure_symbols (void)
CGContextDrawTiledImagePtr = dlsym (RTLD_DEFAULT, "CGContextDrawTiledImage");
CGContextGetTypePtr = dlsym (RTLD_DEFAULT, "CGContextGetType");
- CGContextSetShouldAntialiasFontsPtr = dlsym (RTLD_DEFAULT, "CGContextSetShouldAntialiasFonts");
CGContextCopyPathPtr = dlsym (RTLD_DEFAULT, "CGContextCopyPath");
CGContextGetAllowsFontSmoothingPtr = dlsym (RTLD_DEFAULT, "CGContextGetAllowsFontSmoothing");
CGContextSetAllowsFontSmoothingPtr = dlsym (RTLD_DEFAULT, "CGContextSetAllowsFontSmoothing");
commit 1bc7d948c73397c453526f6e66b3f72668ce2910
Author: Andrea Canciani <ranma42 at gmail.com>
Date: Wed Jun 23 17:34:13 2010 +0200
quartz: Clean up dynamically loaded functions
README indicates MacOSX 10.4 as a requirement for quartz and we are
directly using some functions that have been added to the public
CoreGraphics API in 10.4.
rop 10.3-specific workarounds and link to 10.4 API functions instead
of loading them at runtime.
diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index 4a22221..9a59382 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -99,33 +99,20 @@ typedef enum PrivateCGCompositeMode PrivateCGCompositeMode;
CG_EXTERN void CGContextSetCompositeOperation (CGContextRef, PrivateCGCompositeMode);
CG_EXTERN void CGContextSetCTM (CGContextRef, CGAffineTransform);
-/* We need to work with the 10.3 SDK as well (and 10.3 machines; luckily, 10.3.9
- * has all the stuff we care about, just some of it isn't exported in the SDK.
- */
-#ifndef kCGBitmapByteOrder32Host
-#define USE_10_3_WORKAROUNDS
-#define kCGBitmapAlphaInfoMask 0x1F
-#define kCGBitmapByteOrderMask 0x7000
-#define kCGBitmapByteOrder32Host 0
-
-typedef uint32_t CGBitmapInfo;
-
-/* public in 10.4, present in 10.3.9 */
-CG_EXTERN void CGContextReplacePathWithStrokedPath (CGContextRef);
-CG_EXTERN CGImageRef CGBitmapContextCreateImage (CGContextRef);
-#endif
-
/* Some of these are present in earlier versions of the OS than where
- * they are public; others are not public at all (CGContextCopyPath,
- * CGContextReplacePathWithClipPath, many of the getters, etc.)
+ * they are public; other are not public at all
*/
-static void (*CGContextClipToMaskPtr) (CGContextRef, CGRect, CGImageRef) = NULL;
+/* public since 10.5 */
static void (*CGContextDrawTiledImagePtr) (CGContextRef, CGRect, CGImageRef) = NULL;
+
+/* public since 10.6 */
+static CGPathRef (*CGContextCopyPathPtr) (CGContextRef) = NULL;
+static void (*CGContextSetAllowsFontSmoothingPtr) (CGContextRef, bool) = NULL;
+
+/* not yet public */
static unsigned int (*CGContextGetTypePtr) (CGContextRef) = NULL;
static void (*CGContextSetShouldAntialiasFontsPtr) (CGContextRef, bool) = NULL;
-static void (*CGContextSetAllowsFontSmoothingPtr) (CGContextRef, bool) = NULL;
static bool (*CGContextGetAllowsFontSmoothingPtr) (CGContextRef) = NULL;
-static CGPathRef (*CGContextCopyPathPtr) (CGContextRef) = NULL;
static cairo_bool_t _cairo_quartz_symbol_lookup_done = FALSE;
@@ -153,7 +140,6 @@ static void quartz_ensure_symbols (void)
if (likely (_cairo_quartz_symbol_lookup_done))
return;
- CGContextClipToMaskPtr = dlsym (RTLD_DEFAULT, "CGContextClipToMask");
CGContextDrawTiledImagePtr = dlsym (RTLD_DEFAULT, "CGContextDrawTiledImage");
CGContextGetTypePtr = dlsym (RTLD_DEFAULT, "CGContextGetType");
CGContextSetShouldAntialiasFontsPtr = dlsym (RTLD_DEFAULT, "CGContextSetShouldAntialiasFonts");
@@ -643,10 +629,6 @@ _cairo_quartz_fixup_unbounded_operation (cairo_quartz_surface_t *surface,
CGContextRef cgc;
CGImageRef maskImage;
- /* TODO: handle failure */
- if (!CGContextClipToMaskPtr)
- return;
-
clipBox = CGContextGetClipBoundingBox (surface->cgContext);
clipBoxRound = CGRectIntegral (clipBox);
@@ -740,7 +722,7 @@ _cairo_quartz_fixup_unbounded_operation (cairo_quartz_surface_t *surface,
CGContextSaveGState (surface->cgContext);
CGContextSetCompositeOperation (surface->cgContext, kPrivateCGCompositeCopy);
- CGContextClipToMaskPtr (surface->cgContext, clipBoxRound, maskImage);
+ CGContextClipToMask (surface->cgContext, clipBoxRound, maskImage);
CGImageRelease (maskImage);
/* Finally, clear out the entire clipping region through our mask */
@@ -1407,11 +1389,7 @@ _cairo_quartz_get_image (cairo_quartz_surface_t *surface,
imageData = (unsigned char *) CGBitmapContextGetData (surface->cgContext);
-#ifdef USE_10_3_WORKAROUNDS
- bitinfo = CGBitmapContextGetAlphaInfo (surface->cgContext);
-#else
bitinfo = CGBitmapContextGetBitmapInfo (surface->cgContext);
-#endif
stride = CGBitmapContextGetBytesPerRow (surface->cgContext);
bpp = CGBitmapContextGetBitsPerPixel (surface->cgContext);
bpc = CGBitmapContextGetBitsPerComponent (surface->cgContext);
@@ -2286,7 +2264,7 @@ _cairo_quartz_surface_mask_with_surface (cairo_quartz_surface_t *surface,
mask_matrix = CGAffineTransformScale (mask_matrix, 1.0, -1.0);
CGContextConcatCTM (surface->cgContext, mask_matrix);
- CGContextClipToMaskPtr (surface->cgContext, rect, img);
+ CGContextClipToMask (surface->cgContext, rect, img);
CGContextSetCTM (surface->cgContext, ctm);
@@ -2374,23 +2352,11 @@ _cairo_quartz_surface_mask_cg (cairo_quartz_surface_t *surface,
return rv;
}
- /* If we have CGContextClipToMask, we can do more complex masks */
- if (CGContextClipToMaskPtr) {
- /* For these, we can skip creating a temporary surface, since we already have one */
- if (mask->type == CAIRO_PATTERN_TYPE_SURFACE && mask->extend == CAIRO_EXTEND_NONE)
- return _cairo_quartz_surface_mask_with_surface (surface, op, source, (cairo_surface_pattern_t *) mask, clip);
-
- return _cairo_quartz_surface_mask_with_generic (surface, op, source, mask, clip);
- }
-
- /* So, CGContextClipToMask is not present in 10.3.9, so we're
- * doomed; if we have imageData, we can do fallback, otherwise
- * just pretend success.
- */
- if (surface->imageData)
- return CAIRO_INT_STATUS_UNSUPPORTED;
+ /* For these, we can skip creating a temporary surface, since we already have one */
+ if (mask->type == CAIRO_PATTERN_TYPE_SURFACE && mask->extend == CAIRO_EXTEND_NONE)
+ return _cairo_quartz_surface_mask_with_surface (surface, op, source, (cairo_surface_pattern_t *) mask, clip);
- return CAIRO_STATUS_SUCCESS;
+ return _cairo_quartz_surface_mask_with_generic (surface, op, source, mask, clip);
}
static cairo_int_status_t
More information about the cairo-commit
mailing list