[cairo] [PATCH 2/2] Add the proper propagation of extents
Jeff Muizelaar
jmuizelaar at mozilla.com
Mon Nov 10 16:55:53 PST 2008
This fixes the problems introduced by d682d275b90f7326df76d2764c513c8b6d5b551b
---
src/cairo-quartz-surface.c | 24 +++++++++++++-----------
1 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index 6fa368b..8a5c16e 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -2187,21 +2187,22 @@ static cairo_int_status_t
_cairo_quartz_surface_mask_with_surface (cairo_quartz_surface_t *surface,
cairo_operator_t op,
const cairo_pattern_t *source,
- const cairo_surface_pattern_t *mask)
+ const cairo_surface_pattern_t *mask,
+ cairo_rectangle_int_t *extents)
{
- cairo_rectangle_int_t extents;
+ cairo_rectangle_int_t mask_extents;
CGRect rect;
CGImageRef img;
cairo_surface_t *pat_surf = mask->surface;
cairo_status_t status = CAIRO_STATUS_SUCCESS;
CGAffineTransform ctm, mask_matrix;
- status = _cairo_surface_get_extents (pat_surf, &extents);
+ status = _cairo_surface_get_extents (pat_surf, &mask_extents);
if (status)
return status;
// everything would be masked out, so do nothing
- if (extents.width == 0 || extents.height == 0)
+ if (mask_extents.width == 0 || mask_extents.height == 0)
return CAIRO_STATUS_SUCCESS;
status = _cairo_surface_to_cgimage ((cairo_surface_t *) surface, pat_surf, &img);
@@ -2210,7 +2211,7 @@ _cairo_quartz_surface_mask_with_surface (cairo_quartz_surface_t *surface,
if (status)
return status;
- rect = CGRectMake (0.0f, 0.0f, extents.width, extents.height);
+ rect = CGRectMake (0.0f, 0.0f, mask_extents.width, mask_extents.height);
CGContextSaveGState (surface->cgContext);
@@ -2227,7 +2228,7 @@ _cairo_quartz_surface_mask_with_surface (cairo_quartz_surface_t *surface,
CGContextSetCTM (surface->cgContext, ctm);
- status = _cairo_quartz_surface_paint (surface, op, source);
+ status = _cairo_quartz_surface_paint (surface, op, source, extents);
CGContextRestoreGState (surface->cgContext);
@@ -2252,7 +2253,8 @@ static cairo_int_status_t
_cairo_quartz_surface_mask_with_generic (cairo_quartz_surface_t *surface,
cairo_operator_t op,
const cairo_pattern_t *source,
- const cairo_pattern_t *mask)
+ const cairo_pattern_t *mask,
+ cairo_rectangle_int_t *extents)
{
int width = surface->extents.width - surface->extents.x;
int height = surface->extents.height - surface->extents.y;
@@ -2285,7 +2287,7 @@ _cairo_quartz_surface_mask_with_generic (cairo_quartz_surface_t *surface,
_cairo_pattern_init_for_surface (&surface_pattern, gradient_surf);
- status = _cairo_quartz_surface_mask_with_surface (surface, op, source, &surface_pattern);
+ status = _cairo_quartz_surface_mask_with_surface (surface, op, source, &surface_pattern, extents);
_cairo_pattern_fini (&surface_pattern.base);
@@ -2316,7 +2318,7 @@ _cairo_quartz_surface_mask (void *abstract_surface,
cairo_solid_pattern_t *solid_mask = (cairo_solid_pattern_t *) mask;
CGContextSetAlpha (surface->cgContext, solid_mask->color.alpha);
- rv = _cairo_quartz_surface_paint (surface, op, source);
+ rv = _cairo_quartz_surface_paint (surface, op, source, extents);
CGContextSetAlpha (surface->cgContext, 1.0);
return rv;
@@ -2326,9 +2328,9 @@ _cairo_quartz_surface_mask (void *abstract_surface,
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);
+ return _cairo_quartz_surface_mask_with_surface (surface, op, source, (cairo_surface_pattern_t *) mask, extents);
- return _cairo_quartz_surface_mask_with_generic (surface, op, source, mask);
+ return _cairo_quartz_surface_mask_with_generic (surface, op, source, mask, extents);
}
/* So, CGContextClipToMask is not present in 10.3.9, so we're
More information about the cairo
mailing list