diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-09-21 13:50:00 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-09-21 13:50:00 +0100 |
commit | e00d0627494a4b15ed3b74a704695ca8b81a350e (patch) | |
tree | a157e779508f8a192765c0e677c2f94f8ba65b76 | |
parent | 378b1e73d9f27e9b54ea01b10e588b361848d0cd (diff) |
[xlib] Fix recent bug in unbounded trapezoids
Gah! I had believed that the dst extents and the clip were correct to
enable unbounded fixup for the unbounded trapezoids. I was wrong, so I
need to requery the trapezoid extents. As this information is already
known, I should update the interface to pass along all relevant
information.
-rw-r--r-- | src/cairo-surface.c | 23 | ||||
-rw-r--r-- | src/cairo-xlib-surface.c | 32 |
2 files changed, 29 insertions, 26 deletions
diff --git a/src/cairo-surface.c b/src/cairo-surface.c index 25ce0b92..d66e9301 100644 --- a/src/cairo-surface.c +++ b/src/cairo-surface.c @@ -2631,7 +2631,7 @@ _cairo_surface_composite_fixup_unbounded_internal (cairo_surface_t *dst, /* Now compute the area that is in dst but not drawn */ status = cairo_region_subtract_rectangle (&clear_region, &dst_rectangle); - if (unlikely (status)) + if (unlikely (status) || cairo_region_is_empty (&clear_region)) goto CLEANUP_REGIONS; EMPTY: @@ -2767,9 +2767,8 @@ _cairo_surface_composite_shape_fixup_unbounded (cairo_surface_t *dst, unsigned int height, cairo_region_t *clip_region) { - cairo_rectangle_int_t src_tmp, mask_tmp; - cairo_rectangle_int_t *src_rectangle = NULL; - cairo_rectangle_int_t *mask_rectangle = NULL; + cairo_rectangle_int_t src_tmp, *src= NULL; + cairo_rectangle_int_t mask; if (dst->status) return dst->status; @@ -2784,20 +2783,18 @@ _cairo_surface_composite_shape_fixup_unbounded (cairo_surface_t *dst, { src_tmp.x = (dst_x - (src_x + src_attr->x_offset)); src_tmp.y = (dst_y - (src_y + src_attr->y_offset)); - src_tmp.width = src_width; + src_tmp.width = src_width; src_tmp.height = src_height; - src_rectangle = &src_tmp; + src = &src_tmp; } - mask_tmp.x = dst_x - mask_x; - mask_tmp.y = dst_y - mask_y; - mask_tmp.width = mask_width; - mask_tmp.height = mask_height; + mask.x = dst_x - mask_x; + mask.y = dst_y - mask_y; + mask.width = mask_width; + mask.height = mask_height; - mask_rectangle = &mask_tmp; - - return _cairo_surface_composite_fixup_unbounded_internal (dst, src_rectangle, mask_rectangle, + return _cairo_surface_composite_fixup_unbounded_internal (dst, src, &mask, dst_x, dst_y, width, height, clip_region); } diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index 0352ed77..2b8d31a0 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -2576,26 +2576,32 @@ _cairo_xlib_surface_composite_trapezoids (cairo_operator_t op, xtraps, num_traps); if (xtraps != xtraps_stack) - free(xtraps); + free (xtraps); + + if (! _cairo_operator_bounded_by_mask (op)) { + cairo_traps_t _traps; + cairo_box_t box; + cairo_rectangle_int_t extents; - if (!_cairo_operator_bounded_by_mask (op)) { /* XRenderCompositeTrapezoids() creates a mask only large enough for the * trapezoids themselves, but if the operator is unbounded, then we need - * to actually composite all the way out to the bounds, so we create - * the mask and composite ourselves. There actually would - * be benefit to doing this in all cases, since RENDER implementations - * will frequently create a too temporary big mask, ignoring destination - * bounds and clip. (XRenderAddTraps() could be used to make creating - * the mask somewhat cheaper.) + * to actually composite all the way out to the bounds. */ + /* XXX: update the interface to pass composite rects */ + _traps.traps = traps; + _traps.num_traps = num_traps; + _cairo_traps_extents (&_traps, &box); + _cairo_box_round_to_rectangle (&box, &extents); + status = _cairo_surface_composite_shape_fixup_unbounded (&dst->base, - &attributes, src->width, src->height, - width, height, + &attributes, + src->width, src->height, + extents.width, extents.height, src_x, src_y, - 0, 0, - dst_x, dst_y, width, height, + -extents.x + dst_x, -extents.y + dst_y, + dst_x, dst_y, + width, height, clip_region); - } BAIL: |