mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-25 06:00:10 +01:00
[clip] Intersect to region extents.
When querying the intersection of a rectangle with the clip region, the result only depends upon the region extents so we do not need to perform an expensive region-region intersection computation.
This commit is contained in:
parent
c5acb125e9
commit
09589e20e1
2 changed files with 5 additions and 14 deletions
|
|
@ -179,20 +179,12 @@ _cairo_clip_intersect_to_rectangle (cairo_clip_t *clip,
|
|||
}
|
||||
|
||||
if (clip->has_region) {
|
||||
cairo_region_t intersection;
|
||||
cairo_rectangle_int_t extents;
|
||||
|
||||
_cairo_region_init_rect (&intersection, rectangle);
|
||||
|
||||
status = _cairo_region_intersect (&intersection, &clip->region,
|
||||
&intersection);
|
||||
|
||||
if (!status)
|
||||
_cairo_region_get_extents (&intersection, rectangle);
|
||||
|
||||
_cairo_region_fini (&intersection);
|
||||
|
||||
if (unlikely (status))
|
||||
return status;
|
||||
_cairo_region_get_extents (&clip->region, &extents);
|
||||
is_empty = _cairo_rectangle_intersect (rectangle, &extents);
|
||||
if (is_empty)
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (clip->surface)
|
||||
|
|
|
|||
|
|
@ -578,7 +578,6 @@ _clip_and_composite_trapezoids (const cairo_pattern_t *src,
|
|||
|
||||
has_clear_region = TRUE;
|
||||
status = _cairo_clip_intersect_to_region (clip, &clear_region);
|
||||
|
||||
if (unlikely (status))
|
||||
goto out;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue