[cairo-commit] 5 commits - configure.in src/cairo-quartz.h src/cairo-quartz-image.h src/cairo-quartz-image-surface.c src/cairo-quartz-private.h src/cairo-quartz-surface.c src/Makefile.am test/font-matrix-translation-quartz-ref.png test/glyph-cache-pressure-quartz-ref.png test/linear-gradient-quartz-ref.png test/long-dashed-lines-quartz-ref.png test/Makefile.am test/mask-quartz-ref.png test/operator-clear-quartz-ref.png test/operator-clear-quartz-rgb24-ref.png test/radial-gradient-quartz-ref.png test/random-intersections-quartz-ref.png test/reflected-stroke-quartz-ref.png test/rotate-image-surface-paint-quartz-ref.png test/select-font-face-quartz-ref.png test/show-text-current-point-quartz-ref.png test/text-antialias-gray-quartz-ref.png test/text-pattern-quartz-rgb24-ref.png test/text-rotate-quartz-ref.png test/trap-clip-quartz-ref.png test/unantialiased-shapes-quartz-ref.png
Vladimir Vukicevic
vladimir at kemper.freedesktop.org
Fri Mar 7 16:47:25 PST 2008
configure.in | 15 ++++
src/Makefile.am | 5 +
src/cairo-quartz-image-surface.c | 21 +++--
src/cairo-quartz-image.h | 59 ++++++++++++++++
src/cairo-quartz-private.h | 3
src/cairo-quartz-surface.c | 89 +++++++++++--------------
src/cairo-quartz.h | 6 -
test/Makefile.am | 14 +++
test/font-matrix-translation-quartz-ref.png |binary
test/glyph-cache-pressure-quartz-ref.png |binary
test/linear-gradient-quartz-ref.png |binary
test/long-dashed-lines-quartz-ref.png |binary
test/mask-quartz-ref.png |binary
test/operator-clear-quartz-ref.png |binary
test/operator-clear-quartz-rgb24-ref.png |binary
test/radial-gradient-quartz-ref.png |binary
test/random-intersections-quartz-ref.png |binary
test/reflected-stroke-quartz-ref.png |binary
test/rotate-image-surface-paint-quartz-ref.png |binary
test/select-font-face-quartz-ref.png |binary
test/show-text-current-point-quartz-ref.png |binary
test/text-antialias-gray-quartz-ref.png |binary
test/text-pattern-quartz-rgb24-ref.png |binary
test/text-rotate-quartz-ref.png |binary
test/trap-clip-quartz-ref.png |binary
test/unantialiased-shapes-quartz-ref.png |binary
26 files changed, 149 insertions(+), 63 deletions(-)
New commits:
commit 2e33d5f57bde82b953ebc5f9c1355327a7ac4967
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date: Fri Mar 7 16:46:53 2008 -0800
[quartz] Update a bunch of reference images
Generated with Bitstream Vera font family installed, using ATSUI
font backend.
diff --git a/test/Makefile.am b/test/Makefile.am
index 7201a98..016ea55 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -361,6 +361,7 @@ REFERENCE_IMAGES = \
font-matrix-translation-ps-rgb24-ref.png \
font-matrix-translation-ref.png \
font-matrix-translation-svg-ref.png \
+ font-matrix-translation-quartz-ref.png \
ft-text-antialias-none-ps-argb32-ref.png \
ft-text-antialias-none-ref.png \
ft-text-vertical-layout-type1-ps-ref.png \
@@ -373,6 +374,7 @@ REFERENCE_IMAGES = \
glitz-surface-source-ref.png \
glyph-cache-pressure-ref.png \
glyph-cache-pressure-ps-ref.png \
+ glyph-cache-pressure-quartz-ref.png \
gradient-alpha-pdf-argb32-ref.png \
gradient-alpha-pdf-rgb24-ref.png \
gradient-alpha-ps-argb32-ref.png \
@@ -396,6 +398,7 @@ REFERENCE_IMAGES = \
linear-gradient-reflect-ps-ref.png \
linear-gradient-pdf-ref.png \
linear-gradient-ps-ref.png \
+ linear-gradient-quartz-ref.png \
linear-gradient-ref.png \
linear-gradient-svg-ref.png \
line-width-ref.png \
@@ -404,6 +407,7 @@ REFERENCE_IMAGES = \
line-width-scale-ref.png \
long-dashed-lines-ref.png \
long-dashed-lines-ps-ref.png \
+ long-dashed-lines-quartz-ref.png \
long-lines-ref.png \
mask-alpha-ref.png \
mask-alpha-svg-argb32-ref.png \
@@ -493,9 +497,11 @@ REFERENCE_IMAGES = \
push-group-svg-argb32-ref.png \
radial-gradient-ref.png \
radial-gradient-pdf-ref.png \
+ radial-gradient-quartz-ref.png \
radial-gradient-svg-ref.png \
random-intersections-ref.png \
random-intersections-ps-ref.png \
+ random-intersections-quartz-ref.png \
rgb24-ignore-alpha-ref.png \
rectangle-rounding-error-ref.png \
rectilinear-miter-limit-ref.png \
@@ -503,6 +509,7 @@ REFERENCE_IMAGES = \
rectilinear-stroke-ref.png \
reflected-stroke-ref.png \
reflected-stroke-ps-ref.png \
+ reflected-stroke-quartz-ref.png \
rel-path-quartz-ref.png \
rel-path-quartz-rgb24-ref.png \
rel-path-ps-rgb24-ref.png \
@@ -523,6 +530,7 @@ REFERENCE_IMAGES = \
scale-source-surface-paint-pdf-rgb24-ref.png \
select-font-face-ref.png \
select-font-face-ps-ref.png \
+ select-font-face-quartz-ref.png \
self-copy-ref.png \
self-copy-ps-ref.png \
self-intersecting-ref.png \
@@ -533,6 +541,7 @@ REFERENCE_IMAGES = \
show-glyphs-many-ref.png \
show-text-current-point-ref.png \
show-text-current-point-ps-ref.png \
+ show-text-current-point-quartz-ref.png \
skew-extreme-ref.png \
skew-extreme-ps-ref.png \
source-clip-ref.png \
@@ -557,6 +566,7 @@ REFERENCE_IMAGES = \
surface-pattern-svg-ref.png \
svg-surface-source-ref.png \
text-antialias-gray-ref.png \
+ text-antialias-gray-quartz-ref.png \
text-antialias-none-ref.png \
text-antialias-subpixel-ref.png \
text-glyph-range-ref.png \
@@ -569,9 +579,12 @@ REFERENCE_IMAGES = \
text-pattern-svg-rgb24-ref.png \
text-pattern-pdf-argb32-ref.png \
text-pattern-pdf-rgb24-ref.png \
+ text-pattern-quartz-argb32-ref.png \
+ text-pattern-quartz-rgb24-ref.png \
text-rotate-ref.png \
text-rotate-ps-ref.png \
text-rotate-svg-ref.png \
+ text-rotate-quartz-ref.png \
transforms-ref.png \
transforms-ps-ref.png \
translate-show-surface-ref.png \
@@ -584,6 +597,7 @@ REFERENCE_IMAGES = \
trap-clip-pdf-argb32-ref.png \
trap-clip-pdf-rgb24-ref.png \
unantialiased-shapes-ref.png \
+ unantialiased-shapes-quartz-ref.png \
unbounded-operator-ref.png \
unbounded-operator-rgb24-ref.png \
xlib-surface-source-ref.png \
diff --git a/test/font-matrix-translation-quartz-ref.png b/test/font-matrix-translation-quartz-ref.png
new file mode 100644
index 0000000..c0fbc16
Binary files /dev/null and b/test/font-matrix-translation-quartz-ref.png differ
diff --git a/test/glyph-cache-pressure-quartz-ref.png b/test/glyph-cache-pressure-quartz-ref.png
new file mode 100644
index 0000000..b067e92
Binary files /dev/null and b/test/glyph-cache-pressure-quartz-ref.png differ
diff --git a/test/linear-gradient-quartz-ref.png b/test/linear-gradient-quartz-ref.png
new file mode 100644
index 0000000..43fb508
Binary files /dev/null and b/test/linear-gradient-quartz-ref.png differ
diff --git a/test/long-dashed-lines-quartz-ref.png b/test/long-dashed-lines-quartz-ref.png
new file mode 100644
index 0000000..439263a
Binary files /dev/null and b/test/long-dashed-lines-quartz-ref.png differ
diff --git a/test/mask-quartz-ref.png b/test/mask-quartz-ref.png
index 3925740..a90218a 100644
Binary files a/test/mask-quartz-ref.png and b/test/mask-quartz-ref.png differ
diff --git a/test/operator-clear-quartz-ref.png b/test/operator-clear-quartz-ref.png
index d79d4c3..d0034a7 100644
Binary files a/test/operator-clear-quartz-ref.png and b/test/operator-clear-quartz-ref.png differ
diff --git a/test/operator-clear-quartz-rgb24-ref.png b/test/operator-clear-quartz-rgb24-ref.png
index d47ce75..6f3fc2c 100644
Binary files a/test/operator-clear-quartz-rgb24-ref.png and b/test/operator-clear-quartz-rgb24-ref.png differ
diff --git a/test/radial-gradient-quartz-ref.png b/test/radial-gradient-quartz-ref.png
new file mode 100644
index 0000000..be420f8
Binary files /dev/null and b/test/radial-gradient-quartz-ref.png differ
diff --git a/test/random-intersections-quartz-ref.png b/test/random-intersections-quartz-ref.png
new file mode 100644
index 0000000..ef76cba
Binary files /dev/null and b/test/random-intersections-quartz-ref.png differ
diff --git a/test/reflected-stroke-quartz-ref.png b/test/reflected-stroke-quartz-ref.png
new file mode 100644
index 0000000..7568a99
Binary files /dev/null and b/test/reflected-stroke-quartz-ref.png differ
diff --git a/test/rotate-image-surface-paint-quartz-ref.png b/test/rotate-image-surface-paint-quartz-ref.png
index 0f2f626..f7ec95c 100644
Binary files a/test/rotate-image-surface-paint-quartz-ref.png and b/test/rotate-image-surface-paint-quartz-ref.png differ
diff --git a/test/select-font-face-quartz-ref.png b/test/select-font-face-quartz-ref.png
new file mode 100644
index 0000000..228b227
Binary files /dev/null and b/test/select-font-face-quartz-ref.png differ
diff --git a/test/show-text-current-point-quartz-ref.png b/test/show-text-current-point-quartz-ref.png
new file mode 100644
index 0000000..d96b305
Binary files /dev/null and b/test/show-text-current-point-quartz-ref.png differ
diff --git a/test/text-antialias-gray-quartz-ref.png b/test/text-antialias-gray-quartz-ref.png
new file mode 100644
index 0000000..afe9928
Binary files /dev/null and b/test/text-antialias-gray-quartz-ref.png differ
diff --git a/test/text-pattern-quartz-rgb24-ref.png b/test/text-pattern-quartz-rgb24-ref.png
new file mode 100644
index 0000000..9f4da3a
Binary files /dev/null and b/test/text-pattern-quartz-rgb24-ref.png differ
diff --git a/test/text-rotate-quartz-ref.png b/test/text-rotate-quartz-ref.png
new file mode 100644
index 0000000..9e2c59f
Binary files /dev/null and b/test/text-rotate-quartz-ref.png differ
diff --git a/test/trap-clip-quartz-ref.png b/test/trap-clip-quartz-ref.png
index 70e5b17..d1acd31 100644
Binary files a/test/trap-clip-quartz-ref.png and b/test/trap-clip-quartz-ref.png differ
diff --git a/test/unantialiased-shapes-quartz-ref.png b/test/unantialiased-shapes-quartz-ref.png
new file mode 100644
index 0000000..0760505
Binary files /dev/null and b/test/unantialiased-shapes-quartz-ref.png differ
commit fb1378a24b5c6cd65b73aa611bb049ebb6f2b57a
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date: Fri Mar 7 16:46:15 2008 -0800
[quartz] Correctly handle gradients with non-identity pattern transform
Fixes http://bugs.freedesktop.org/show_bug.cgi?id=14248
diff --git a/src/cairo-quartz-private.h b/src/cairo-quartz-private.h
index cf26f4f..41732fb 100644
--- a/src/cairo-quartz-private.h
+++ b/src/cairo-quartz-private.h
@@ -57,9 +57,10 @@ typedef struct cairo_quartz_surface {
/* These are stored while drawing operations are in place, set up
* by quartz_setup_source() and quartz_finish_source()
*/
+ CGAffineTransform sourceTransform;
+
CGImageRef sourceImage;
cairo_surface_t *sourceImageSurface;
- CGAffineTransform sourceImageTransform;
CGRect sourceImageRect;
CGShadingRef sourceShading;
diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index 4f89378..b452549 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -643,7 +643,6 @@ _cairo_quartz_setup_linear_source (cairo_quartz_surface_t *surface,
{
cairo_pattern_t *abspat = (cairo_pattern_t *) lpat;
cairo_matrix_t mat;
- double x0, y0;
CGPoint start, end;
CGFunctionRef gradFunc;
CGColorSpaceRef rgb;
@@ -656,31 +655,22 @@ _cairo_quartz_setup_linear_source (cairo_quartz_surface_t *surface,
abspat->extend == CAIRO_EXTEND_REPEAT)
return DO_UNSUPPORTED;
- /* We can only do this if we have an identity pattern matrix;
- * otherwise fall back through to the generic pattern case.
- * XXXperf we could optimize this by creating a pattern with the shading;
- * but we'd need to know the extents to do that.
- * ... but we don't care; we can use the surface extents for it
- * XXXtodo - implement gradients with non-identity pattern matrices
- */
- cairo_pattern_get_matrix (abspat, &mat);
- if (mat.xx != 1.0 || mat.yy != 1.0 || mat.xy != 0.0 || mat.yx != 0.0)
- return DO_UNSUPPORTED;
-
- if (!lpat->base.n_stops) {
+ if (lpat->base.n_stops == 0) {
CGContextSetRGBStrokeColor (surface->cgContext, 0., 0., 0., 0.);
CGContextSetRGBFillColor (surface->cgContext, 0., 0., 0., 0.);
return DO_SOLID;
}
- x0 = mat.x0;
- y0 = mat.y0;
+ cairo_pattern_get_matrix (abspat, &mat);
+ cairo_matrix_invert (&mat);
+ _cairo_quartz_cairo_matrix_to_quartz (&mat, &surface->sourceTransform);
+
rgb = CGColorSpaceCreateDeviceRGB();
- start = CGPointMake (_cairo_fixed_to_double (lpat->p1.x) - x0,
- _cairo_fixed_to_double (lpat->p1.y) - y0);
- end = CGPointMake (_cairo_fixed_to_double (lpat->p2.x) - x0,
- _cairo_fixed_to_double (lpat->p2.y) - y0);
+ start = CGPointMake (_cairo_fixed_to_double (lpat->p1.x),
+ _cairo_fixed_to_double (lpat->p1.y));
+ end = CGPointMake (_cairo_fixed_to_double (lpat->p2.x),
+ _cairo_fixed_to_double (lpat->p2.y));
cairo_pattern_reference (abspat);
gradFunc = CreateGradientFunction ((cairo_gradient_pattern_t*) lpat);
@@ -700,7 +690,7 @@ _cairo_quartz_setup_radial_source (cairo_quartz_surface_t *surface,
{
cairo_pattern_t *abspat = (cairo_pattern_t *)rpat;
cairo_matrix_t mat;
- double x0, y0;
+ CGAffineTransform cgmat;
CGPoint start, end;
CGFunctionRef gradFunc;
CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB();
@@ -713,26 +703,22 @@ _cairo_quartz_setup_radial_source (cairo_quartz_surface_t *surface,
abspat->extend == CAIRO_EXTEND_REPEAT)
return DO_UNSUPPORTED;
- /* XXXtodo - implement gradients with non-identity pattern matrices
- */
- cairo_pattern_get_matrix (abspat, &mat);
- if (mat.xx != 1.0 || mat.yy != 1.0 || mat.xy != 0.0 || mat.yx != 0.0)
- return DO_UNSUPPORTED;
-
- if (!rpat->base.n_stops) {
+ if (rpat->base.n_stops == 0) {
CGContextSetRGBStrokeColor (surface->cgContext, 0., 0., 0., 0.);
CGContextSetRGBFillColor (surface->cgContext, 0., 0., 0., 0.);
return DO_SOLID;
}
- x0 = mat.x0;
- y0 = mat.y0;
+ cairo_pattern_get_matrix (abspat, &mat);
+ cairo_matrix_invert (&mat);
+ _cairo_quartz_cairo_matrix_to_quartz (&mat, &surface->sourceTransform);
+
rgb = CGColorSpaceCreateDeviceRGB();
- start = CGPointMake (_cairo_fixed_to_double (rpat->c1.x) - x0,
- _cairo_fixed_to_double (rpat->c1.y) - y0);
- end = CGPointMake (_cairo_fixed_to_double (rpat->c2.x) - x0,
- _cairo_fixed_to_double (rpat->c2.y) - y0);
+ start = CGPointMake (_cairo_fixed_to_double (rpat->c1.x),
+ _cairo_fixed_to_double (rpat->c1.y));
+ end = CGPointMake (_cairo_fixed_to_double (rpat->c2.x),
+ _cairo_fixed_to_double (rpat->c2.y));
cairo_pattern_reference (abspat);
gradFunc = CreateGradientFunction ((cairo_gradient_pattern_t*) rpat);
@@ -807,7 +793,7 @@ _cairo_quartz_setup_source (cairo_quartz_surface_t *surface,
surface->sourceImage = img;
cairo_matrix_invert(&m);
- _cairo_quartz_cairo_matrix_to_quartz (&m, &surface->sourceImageTransform);
+ _cairo_quartz_cairo_matrix_to_quartz (&m, &surface->sourceTransform);
status = _cairo_surface_get_extents (pat_surf, &extents);
if (status)
@@ -826,7 +812,7 @@ _cairo_quartz_setup_source (cairo_quartz_surface_t *surface,
*/
xform = CGAffineTransformConcat (CGContextGetCTM (surface->cgContext),
- surface->sourceImageTransform);
+ surface->sourceTransform);
srcRect = CGRectMake (0, 0, extents.width, extents.height);
srcRect = CGRectApplyAffineTransform (srcRect, xform);
@@ -1250,11 +1236,12 @@ _cairo_quartz_surface_paint (void *abstract_surface,
surface->extents.width,
surface->extents.height));
} else if (action == DO_SHADING) {
+ CGContextConcatCTM (surface->cgContext, surface->sourceTransform);
CGContextDrawShading (surface->cgContext, surface->sourceShading);
} else if (action == DO_IMAGE || action == DO_TILED_IMAGE) {
CGContextSaveGState (surface->cgContext);
- CGContextConcatCTM (surface->cgContext, surface->sourceImageTransform);
+ CGContextConcatCTM (surface->cgContext, surface->sourceTransform);
CGContextTranslateCTM (surface->cgContext, 0, surface->sourceImageRect.size.height);
CGContextScaleCTM (surface->cgContext, 1, -1);
@@ -1335,6 +1322,7 @@ _cairo_quartz_surface_fill (void *abstract_surface,
else
CGContextEOClip (surface->cgContext);
+ CGContextConcatCTM (surface->cgContext, surface->sourceTransform);
CGContextDrawShading (surface->cgContext, surface->sourceShading);
} else if (action == DO_IMAGE || action == DO_TILED_IMAGE) {
if (fill_rule == CAIRO_FILL_RULE_WINDING)
@@ -1342,7 +1330,7 @@ _cairo_quartz_surface_fill (void *abstract_surface,
else
CGContextEOClip (surface->cgContext);
- CGContextConcatCTM (surface->cgContext, surface->sourceImageTransform);
+ CGContextConcatCTM (surface->cgContext, surface->sourceTransform);
CGContextTranslateCTM (surface->cgContext, 0, surface->sourceImageRect.size.height);
CGContextScaleCTM (surface->cgContext, 1, -1);
@@ -1441,7 +1429,7 @@ _cairo_quartz_surface_stroke (void *abstract_surface,
CGContextReplacePathWithStrokedPath (surface->cgContext);
CGContextClip (surface->cgContext);
- CGContextConcatCTM (surface->cgContext, surface->sourceImageTransform);
+ CGContextConcatCTM (surface->cgContext, surface->sourceTransform);
CGContextTranslateCTM (surface->cgContext, 0, surface->sourceImageRect.size.height);
CGContextScaleCTM (surface->cgContext, 1, -1);
@@ -1453,6 +1441,7 @@ _cairo_quartz_surface_stroke (void *abstract_surface,
CGContextReplacePathWithStrokedPath (surface->cgContext);
CGContextClip (surface->cgContext);
+ CGContextConcatCTM (surface->cgContext, surface->sourceTransform);
CGContextDrawShading (surface->cgContext, surface->sourceShading);
} else if (action != DO_NOTHING) {
rv = CAIRO_INT_STATUS_UNSUPPORTED;
@@ -1597,7 +1586,7 @@ _cairo_quartz_surface_show_glyphs (void *abstract_surface,
CGContextSetCTM (surface->cgContext, ctm);
if (action == DO_IMAGE || action == DO_TILED_IMAGE) {
- CGContextConcatCTM (surface->cgContext, surface->sourceImageTransform);
+ CGContextConcatCTM (surface->cgContext, surface->sourceTransform);
CGContextTranslateCTM (surface->cgContext, 0, surface->sourceImageRect.size.height);
CGContextScaleCTM (surface->cgContext, 1, -1);
@@ -1606,6 +1595,7 @@ _cairo_quartz_surface_show_glyphs (void *abstract_surface,
else
CGContextDrawTiledImagePtr (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
} else if (action == DO_SHADING) {
+ CGContextConcatCTM (surface->cgContext, surface->sourceTransform);
CGContextDrawShading (surface->cgContext, surface->sourceShading);
}
commit 6c7610067f8a131a4fbba8d2b6a88c27ef229bbe
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date: Fri Mar 7 15:35:31 2008 -0800
[quartz] handle antialiasing correctly in stroke() and clip()
A CoreGraphics bug was fixed so strokes are no longer incorrectly
drawn with antialiasing disabled; we no longer have to ignore
antialiasing for stroke(). Also, antialiasing was not being
correctly set for clip(). This fixes both issues.
diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index 2ea5aef..4f89378 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -1390,9 +1390,10 @@ _cairo_quartz_surface_stroke (void *abstract_surface,
CGContextSaveGState (surface->cgContext);
- // Turning antialiasing off causes misrendering with
- // single-pixel lines (e.g. 20,10.5 -> 21,10.5 end up being rendered as 2 pixels)
- //CGContextSetShouldAntialias (surface->cgContext, (antialias != CAIRO_ANTIALIAS_NONE));
+ // Turning antialiasing off used to cause misrendering with
+ // single-pixel lines (e.g. 20,10.5 -> 21,10.5 end up being rendered as 2 pixels).
+ // That's been since fixed in at least 10.5, and in the latest 10.4 dot releases.
+ CGContextSetShouldAntialias (surface->cgContext, (antialias != CAIRO_ANTIALIAS_NONE));
CGContextSetLineWidth (surface->cgContext, style->line_width);
CGContextSetLineCap (surface->cgContext, _cairo_quartz_cairo_line_cap_to_quartz (style->line_cap));
CGContextSetLineJoin (surface->cgContext, _cairo_quartz_cairo_line_join_to_quartz (style->line_join));
@@ -1798,6 +1799,8 @@ _cairo_quartz_surface_intersect_clip_path (void *abstract_surface,
stroke.cgContext = surface->cgContext;
stroke.ctm_inverse = NULL;
+ CGContextSetShouldAntialias (surface->cgContext, (antialias != CAIRO_ANTIALIAS_NONE));
+
/* path must not be empty. */
CGContextMoveToPoint (surface->cgContext, 0, 0);
status = _cairo_quartz_cairo_path_to_quartz_context (path, &stroke);
commit 21dab3c5e9fe1ff344ff809053618c2c8f0710f3
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date: Fri Mar 7 14:49:46 2008 -0800
[quartz] look up the right symbol name for CGContextGetType
diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index e81b378..2ea5aef 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -133,7 +133,7 @@ static void quartz_ensure_symbols(void)
CGContextClipToMaskPtr = dlsym(RTLD_DEFAULT, "CGContextClipToMask");
CGContextDrawTiledImagePtr = dlsym(RTLD_DEFAULT, "CGContextDrawTiledImage");
- CGContextGetTypePtr = dlsym(RTLD_DEFAULT, "CGContextGetTypePtr");
+ CGContextGetTypePtr = dlsym(RTLD_DEFAULT, "CGContextGetType");
_cairo_quartz_symbol_lookup_done = TRUE;
}
commit e52bad5e33e0b69b868525056c95ebd473fd6b10
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date: Fri Mar 7 14:49:15 2008 -0800
[quartz] split out (experimental) quartz-image into separate file
diff --git a/configure.in b/configure.in
index 9feb621..4f19830 100644
--- a/configure.in
+++ b/configure.in
@@ -342,6 +342,16 @@ CAIRO_BACKEND_ENABLE(quartz, Quartz, quartz, QUARTZ_SURFACE, no, [
quartz_LIBS="-Xlinker -framework -Xlinker Carbon"
])
+CAIRO_BACKEND_ENABLE(quartz_image, Quartz Image, quartz-image, QUARTZ_IMAGE_SURFACE, no, [
+ dnl There is no pkgconfig for quartz; lets do a header check
+ if test "x$use_quartz" != "xyes"; then
+ use_quartz_image="no (requires --enable-quartz)"
+ else
+ dnl we already have the header check and libs required from the quartz surface
+ use_quartz_image="yes"
+ fi
+])
+
dnl ===========================================================================
AC_MSG_CHECKING([for native Win32])
@@ -1060,6 +1070,7 @@ echo " image: yes (always builtin)"
echo " Xlib: $use_xlib"
echo " Xlib Xrender: $use_xlib_xrender"
echo " Quartz: $use_quartz"
+echo " Quartz-image: $use_quartz_image"
echo " XCB: $use_xcb"
echo " Win32: $use_win32"
echo " OS2: $use_os2"
@@ -1121,6 +1132,10 @@ if test x"$use_quartz" = "xyes" ; then
echo "$WARNING_MESSAGE" | sed 's/@BACKEND@/Quartz/'
fi
+if test x"$use_quartz_image" = "xyes" ; then
+ echo "$WARNING_MESSAGE" | sed 's/@BACKEND@/Quartz Image/'
+fi
+
if test x"$use_atsui" = "xyes" ; then
echo "$WARNING_MESSAGE" | sed 's/@BACKEND@/ATSUI/'
fi
diff --git a/src/Makefile.am b/src/Makefile.am
index 3656f05..79e3877 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -186,6 +186,11 @@ cairo_sources += $(quartz_sources)
backend_pkgconfigs += cairo-quartz.pc
endif
+if CAIRO_HAS_QUARTZ_IMAGE_SURFACE
+cairo_headers += cairo-quartz-image.h
+backend_pkgconfigs += cairo-quartz-image.pc
+endif
+
os_win32_sources = cairo-win32.c
cairo_all_sources += $(os_win32_sources)
if OS_WIN32
diff --git a/src/cairo-quartz-image-surface.c b/src/cairo-quartz-image-surface.c
index 54b63fc..541fa82 100644
--- a/src/cairo-quartz-image-surface.c
+++ b/src/cairo-quartz-image-surface.c
@@ -36,18 +36,15 @@
#include "cairoint.h"
+#ifdef CAIRO_HAS_QUARTZ_IMAGE_SURFACE
+#include "cairo-quartz-image.h"
+#endif
+
#include "cairo-quartz-private.h"
#define SURFACE_ERROR_NO_MEMORY (_cairo_surface_create_in_error(_cairo_error(CAIRO_STATUS_NO_MEMORY)))
#define SURFACE_ERROR_INVALID_FORMAT (_cairo_surface_create_in_error(_cairo_error(CAIRO_STATUS_INVALID_FORMAT)))
-static void
-DataProviderReleaseCallback (void *info, const void *data, size_t size)
-{
- cairo_surface_t *surface = (cairo_surface_t *) info;
- cairo_surface_destroy (surface);
-}
-
CGImageRef
_cairo_quartz_create_cgimage (cairo_format_t format,
unsigned int width,
@@ -129,6 +126,14 @@ FINISH:
return image;
}
+#ifdef CAIRO_HAS_QUARTZ_IMAGE_SURFACE
+
+static void
+DataProviderReleaseCallback (void *info, const void *data, size_t size)
+{
+ cairo_surface_t *surface = (cairo_surface_t *) info;
+ cairo_surface_destroy (surface);
+}
static cairo_surface_t *
_cairo_quartz_image_surface_create_similar (void *asurface,
@@ -368,3 +373,5 @@ cairo_quartz_image_surface_get_image (cairo_surface_t *asurface)
return (cairo_surface_t*) surface->imageSurface;
}
+
+#endif /* CAIRO_HAS_QUARTZ_IMAGE_SURFACE */
diff --git a/src/cairo-quartz-image.h b/src/cairo-quartz-image.h
new file mode 100644
index 0000000..ae2b2f1
--- /dev/null
+++ b/src/cairo-quartz-image.h
@@ -0,0 +1,59 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2008 Mozilla Corporation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is Mozilla Corporation.
+ *
+ * Contributor(s):
+ * Vladimir Vukicevic <vladimir at mozilla.com>
+ */
+
+#ifndef CAIRO_QUARTZ_IMAGE_H
+#define CAIRO_QUARTZ_IMAGE_H
+
+#include <cairo.h>
+
+#if CAIRO_HAS_QUARTZ_IMAGE_SURFACE
+
+#include <Carbon/Carbon.h>
+
+CAIRO_BEGIN_DECLS
+
+cairo_public cairo_surface_t *
+cairo_quartz_image_surface_create (cairo_surface_t *image_surface);
+
+cairo_public cairo_surface_t *
+cairo_quartz_image_surface_get_image (cairo_surface_t *surface);
+
+CAIRO_END_DECLS
+
+#else /* CAIRO_HAS_QUARTZ_IMAGE_SURFACE */
+# error Cairo was not compiled with support for the quartz-image backend
+#endif /* CAIRO_HAS_QUARTZ_IMAGE_SURFACE */
+
+#endif /* CAIRO_QUARTZ_IMAGE_H */
diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index a9f6580..e81b378 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -114,8 +114,10 @@ static cairo_bool_t _cairo_quartz_symbol_lookup_done = FALSE;
* Utility functions
*/
+#ifdef QUARTZ_DEBUG
static void quartz_surface_to_png (cairo_quartz_surface_t *nq, char *dest);
static void quartz_image_to_png (CGImageRef, char *dest);
+#endif
static cairo_quartz_surface_t *
_cairo_quartz_surface_create_internal (CGContextRef cgContext,
@@ -2130,12 +2132,9 @@ void ExportCGImageToPNGFile(CGImageRef inImageRef, char* dest)
}
}
-#endif
-
void
quartz_image_to_png (CGImageRef imgref, char *dest)
{
-#if 0
static int sctr = 0;
char sptr[] = "/Users/vladimir/Desktop/barXXXXX.png";
@@ -2147,13 +2146,11 @@ quartz_image_to_png (CGImageRef imgref, char *dest)
}
ExportCGImageToPNGFile(imgref, dest);
-#endif
}
void
quartz_surface_to_png (cairo_quartz_surface_t *nq, char *dest)
{
-#if 0
static int sctr = 0;
char sptr[] = "/Users/vladimir/Desktop/fooXXXXX.png";
@@ -2178,5 +2175,6 @@ quartz_surface_to_png (cairo_quartz_surface_t *nq, char *dest)
ExportCGImageToPNGFile(imgref, dest);
CGImageRelease(imgref);
-#endif
}
+
+#endif /* QUARTZ_DEBUG */
diff --git a/src/cairo-quartz.h b/src/cairo-quartz.h
index c0edb0c..5d78d39 100644
--- a/src/cairo-quartz.h
+++ b/src/cairo-quartz.h
@@ -57,12 +57,6 @@ cairo_quartz_surface_create_for_cg_context (CGContextRef cgContext,
cairo_public CGContextRef
cairo_quartz_surface_get_cg_context (cairo_surface_t *surface);
-cairo_public cairo_surface_t *
-cairo_quartz_image_surface_create (cairo_surface_t *image_surface);
-
-cairo_public cairo_surface_t *
-cairo_quartz_image_surface_get_image (cairo_surface_t *surface);
-
CAIRO_END_DECLS
#else /* CAIRO_HAS_QUARTZ_SURFACE */
More information about the cairo-commit
mailing list