From 6b7c6536419368faed0b7b5c8bff8dcc279c13f3 Mon Sep 17 00:00:00 2001 From: Emanuele Aina Date: Fri, 2 Jan 2015 12:44:13 +0100 Subject: [PATCH] spans: Directly replay recording surfaces for OVER to avoid a copy Instead of replaying recording surfaces to a temporary surface and then composite the result on the destination, avoid the copy and handle OVER by replaying the recorded trace directly on the destination but omitting the clearing of the target surface. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=88203 Signed-off-by: Emanuele Aina --- src/cairo-spans-compositor.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cairo-spans-compositor.c b/src/cairo-spans-compositor.c index efbae254bf48..b0b7438a42d1 100644 --- a/src/cairo-spans-compositor.c +++ b/src/cairo-spans-compositor.c @@ -552,6 +552,7 @@ composite_aligned_boxes (const cairo_spans_compositor_t *compositor, cairo_int_status_t status; cairo_bool_t need_clip_mask = ! _clip_is_region (extents->clip); cairo_bool_t op_is_source; + cairo_bool_t replay_recording; cairo_bool_t no_mask; cairo_bool_t inplace; @@ -565,7 +566,8 @@ composite_aligned_boxes (const cairo_spans_compositor_t *compositor, no_mask = extents->mask_pattern.base.type == CAIRO_PATTERN_TYPE_SOLID && CAIRO_COLOR_IS_OPAQUE (&extents->mask_pattern.solid.color); op_is_source = op_reduces_to_source (extents, no_mask); - inplace = ! need_clip_mask && op_is_source && no_mask; + replay_recording = is_recording_pattern(&extents->source_pattern.base) && extents->op == CAIRO_OPERATOR_OVER; + inplace = ! need_clip_mask && (op_is_source || replay_recording) && no_mask; TRACE ((stderr, "%s: op-is-source=%d [op=%d], no-mask=%d, inplace=%d\n", __FUNCTION__, op_is_source, op, no_mask, inplace)); @@ -591,7 +593,7 @@ composite_aligned_boxes (const cairo_spans_compositor_t *compositor, /* XXX could also do tiling repeat modes... */ /* first clear the area about to be overwritten */ - if (! dst->is_clear) { + if (extents->op == CAIRO_OPERATOR_SOURCE && ! dst->is_clear) { status = compositor->fill_boxes (dst, CAIRO_OPERATOR_CLEAR, CAIRO_COLOR_TRANSPARENT, -- 2.1.4