[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.
This commit is contained in:
Chris Wilson 2009-09-21 13:50:00 +01:00
parent 378b1e73d9
commit e00d062749
2 changed files with 31 additions and 28 deletions

View file

@ -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);
}

View file

@ -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.
*/
status = _cairo_surface_composite_shape_fixup_unbounded (&dst->base,
&attributes, src->width, src->height,
width, height,
src_x, src_y,
0, 0,
dst_x, dst_y, width, height,
clip_region);
/* 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,
extents.width, extents.height,
src_x, src_y,
-extents.x + dst_x, -extents.y + dst_y,
dst_x, dst_y,
width, height,
clip_region);
}
BAIL: