mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-06 17:28:02 +02: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) {
|
if (clip->has_region) {
|
||||||
cairo_region_t intersection;
|
cairo_rectangle_int_t extents;
|
||||||
|
|
||||||
_cairo_region_init_rect (&intersection, rectangle);
|
_cairo_region_get_extents (&clip->region, &extents);
|
||||||
|
is_empty = _cairo_rectangle_intersect (rectangle, &extents);
|
||||||
status = _cairo_region_intersect (&intersection, &clip->region,
|
if (is_empty)
|
||||||
&intersection);
|
return CAIRO_STATUS_SUCCESS;
|
||||||
|
|
||||||
if (!status)
|
|
||||||
_cairo_region_get_extents (&intersection, rectangle);
|
|
||||||
|
|
||||||
_cairo_region_fini (&intersection);
|
|
||||||
|
|
||||||
if (unlikely (status))
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clip->surface)
|
if (clip->surface)
|
||||||
|
|
|
||||||
|
|
@ -578,7 +578,6 @@ _clip_and_composite_trapezoids (const cairo_pattern_t *src,
|
||||||
|
|
||||||
has_clear_region = TRUE;
|
has_clear_region = TRUE;
|
||||||
status = _cairo_clip_intersect_to_region (clip, &clear_region);
|
status = _cairo_clip_intersect_to_region (clip, &clear_region);
|
||||||
|
|
||||||
if (unlikely (status))
|
if (unlikely (status))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue