pdf: Use the helper functions to update the composite rectangles

These functions also know to update the clip and recompute the sample
areas and other derived information.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2011-09-18 08:25:11 +01:00
parent 6c6bd6fb29
commit e4ebee1cf4

View file

@ -6104,6 +6104,8 @@ _cairo_pdf_surface_mask (void *abstract_surface,
cairo_pdf_smask_group_t *group;
cairo_composite_rectangles_t extents;
cairo_int_status_t status;
cairo_rectangle_int_t r;
cairo_box_t box;
status = _cairo_composite_rectangles_init_for_mask (&extents,
&surface->base,
@ -6141,18 +6143,25 @@ _cairo_pdf_surface_mask (void *abstract_surface,
assert (_cairo_pdf_surface_operation_supported (surface, op, mask, &extents.bounded));
/* get the accurate extents */
status = _cairo_pattern_get_ink_extents (source, &extents.source);
status = _cairo_pattern_get_ink_extents (source, &r);
if (unlikely (status))
goto cleanup;
if (! _cairo_rectangle_intersect (&extents.bounded, &extents.source))
goto cleanup;
status = _cairo_pattern_get_ink_extents (mask, &extents.mask);
/* XXX slight impedance mismatch */
_cairo_box_from_rectangle (&box, &r);
status = _cairo_composite_rectangles_intersect_source_extents (&extents,
&box);
if (unlikely (status))
goto cleanup;
if (! _cairo_rectangle_intersect (&extents.bounded, &extents.mask))
status = _cairo_pattern_get_ink_extents (mask, &r);
if (unlikely (status))
goto cleanup;
_cairo_box_from_rectangle (&box, &r);
status = _cairo_composite_rectangles_intersect_mask_extents (&extents,
&box);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_surface_set_clip (surface, &extents);