diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-01-11 13:10:56 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-01-11 13:18:26 +0000 |
commit | 503b6b9e2ea65805a77d527c00cf242ec86d479b (patch) | |
tree | 0c9b506f677f2e0aa63268cb81291f9b254c4d19 /src/cairo-mask-compositor.c | |
parent | 1bcd59ef4c9dceaefa51ec6db1f5240d75940724 (diff) | |
download | cairo-503b6b9e2ea65805a77d527c00cf242ec86d479b.tar.gz |
xlib: Only fallback through the mask intermediate if we can composite the mask
Before rendering into the mask, we should first check whether the
subsequent call to composite the mask will trigger a fallback. In that
case, we should fallback earlier and do the operation in place.
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.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/cairo-mask-compositor.c b/src/cairo-mask-compositor.c index 7976a7983..b4bc2be05 100644 --- a/src/cairo-mask-compositor.c +++ b/src/cairo-mask-compositor.c @@ -960,6 +960,10 @@ _cairo_mask_compositor_paint (const cairo_compositor_t *_compositor, cairo_boxes_t boxes; cairo_int_status_t status; + status = compositor->check_composite (extents); + if (unlikely (status)) + return status; + _cairo_clip_steal_boxes (extents->clip, &boxes); status = clip_and_composite_boxes (compositor, extents, &boxes); _cairo_clip_unsteal_boxes (extents->clip, &boxes); @@ -1210,6 +1214,10 @@ _cairo_mask_compositor_mask (const cairo_compositor_t *_compositor, const cairo_mask_compositor_t *compositor = (cairo_mask_compositor_t*)_compositor; cairo_int_status_t status = CAIRO_INT_STATUS_UNSUPPORTED; + status = compositor->check_composite (extents); + if (unlikely (status)) + return status; + if (extents->mask_pattern.base.type == CAIRO_PATTERN_TYPE_SOLID && extents->clip->path == NULL && ! _cairo_clip_is_region (extents->clip)) { @@ -1242,9 +1250,12 @@ _cairo_mask_compositor_stroke (const cairo_compositor_t *_compositor, const cairo_mask_compositor_t *compositor = (cairo_mask_compositor_t*)_compositor; cairo_surface_t *mask; cairo_surface_pattern_t pattern; - cairo_int_status_t status; + cairo_int_status_t status = CAIRO_INT_STATUS_UNSUPPORTED; + + status = compositor->check_composite (extents); + if (unlikely (status)) + return status; - status = CAIRO_INT_STATUS_UNSUPPORTED; if (_cairo_path_fixed_stroke_is_rectilinear (path)) { cairo_boxes_t boxes; @@ -1311,9 +1322,12 @@ _cairo_mask_compositor_fill (const cairo_compositor_t *_compositor, const cairo_mask_compositor_t *compositor = (cairo_mask_compositor_t*)_compositor; cairo_surface_t *mask; cairo_surface_pattern_t pattern; - cairo_int_status_t status; + cairo_int_status_t status = CAIRO_INT_STATUS_UNSUPPORTED; + + status = compositor->check_composite (extents); + if (unlikely (status)) + return status; - status = CAIRO_INT_STATUS_UNSUPPORTED; if (_cairo_path_fixed_fill_is_rectilinear (path)) { cairo_boxes_t boxes; @@ -1374,10 +1388,15 @@ _cairo_mask_compositor_glyphs (const cairo_compositor_t *_compositor, int num_glyphs, cairo_bool_t overlap) { + const cairo_mask_compositor_t *compositor = (cairo_mask_compositor_t*)_compositor; cairo_surface_t *mask; cairo_surface_pattern_t pattern; cairo_int_status_t status; + status = compositor->check_composite (extents); + if (unlikely (status)) + return CAIRO_INT_STATUS_UNSUPPORTED; + mask = cairo_surface_create_similar_image (extents->surface, CAIRO_FORMAT_A8, extents->bounded.width, |