summaryrefslogtreecommitdiff
path: root/src/cairo-mask-compositor.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-02-09 13:01:17 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-02-09 13:01:17 +0000
commit2061cd81f26c04deb5a7092744295caab7bac077 (patch)
tree9190b32541c48e1440f6581c34f3253092597984 /src/cairo-mask-compositor.c
parent7c34997a3ba89f2e957953aeb4bffa910dbf375b (diff)
Replace the ad-hoc surface unwrappers with a function pointer
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-mask-compositor.c')
-rw-r--r--src/cairo-mask-compositor.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/src/cairo-mask-compositor.c b/src/cairo-mask-compositor.c
index b34ffa25..807ba996 100644
--- a/src/cairo-mask-compositor.c
+++ b/src/cairo-mask-compositor.c
@@ -778,39 +778,30 @@ upload_boxes (const cairo_mask_compositor_t *compositor,
{
cairo_surface_t *dst = extents->surface;
const cairo_pattern_t *source = &extents->source_pattern.base;
- const cairo_surface_pattern_t *pattern;
cairo_surface_t *src;
cairo_rectangle_int_t limit;
cairo_int_status_t status;
int tx, ty;
- pattern = (const cairo_surface_pattern_t *) source;
- src = pattern->surface;
+ src = _cairo_pattern_get_source ((cairo_surface_pattern_t *)source, &limit);
if (!(src->type == CAIRO_SURFACE_TYPE_IMAGE || src->type == dst->type))
return CAIRO_INT_STATUS_UNSUPPORTED;
if (! _cairo_matrix_is_integer_translation (&source->matrix, &tx, &ty))
return CAIRO_INT_STATUS_UNSUPPORTED;
- if (_cairo_surface_is_snapshot (src))
- src = _cairo_surface_snapshot_get_target (src);
- if (_cairo_surface_is_observer (src))
- src = _cairo_surface_observer_get_target (src);
- if (_cairo_surface_is_subsurface (src)) {
- _cairo_surface_subsurface_offset (src, &tx, &ty);
- src = _cairo_surface_subsurface_get_target (src);
- }
-
/* Check that the data is entirely within the image */
- if (extents->bounded.x + tx < 0 || extents->bounded.y + ty < 0)
+ if (extents->bounded.x + tx < limit.x || extents->bounded.y + ty < limit.y)
return CAIRO_INT_STATUS_UNSUPPORTED;
- _cairo_surface_get_extents (pattern->surface, &limit);
- if (extents->bounded.x + extents->bounded.width + tx > limit.width ||
- extents->bounded.y + extents->bounded.height + ty > limit.height)
+ if (extents->bounded.x + extents->bounded.width + tx > limit.x + limit.width ||
+ extents->bounded.y + extents->bounded.height + ty > limit.y + limit.height)
return CAIRO_INT_STATUS_UNSUPPORTED;
- if (pattern->surface->type == CAIRO_SURFACE_TYPE_IMAGE)
+ tx += limit.x;
+ ty += limit.y;
+
+ if (src->type == CAIRO_SURFACE_TYPE_IMAGE)
status = compositor->draw_image_boxes (dst,
(cairo_image_surface_t *)src,
boxes, tx, ty);