mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 00:38:06 +02:00
spans-compositor: Handle unaligned unbounded boxes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
2d26f7da77
commit
197e5b7324
1 changed files with 51 additions and 16 deletions
|
|
@ -111,11 +111,31 @@ get_clip_surface (const cairo_spans_compositor_t *compositor,
|
|||
if (unlikely (status))
|
||||
goto cleanup_polygon;
|
||||
|
||||
antialias = clip_path->antialias;
|
||||
fill_rule = clip_path->fill_rule;
|
||||
|
||||
if (clip->boxes) {
|
||||
cairo_polygon_t intersect;
|
||||
cairo_boxes_t tmp;
|
||||
|
||||
_cairo_boxes_init_for_array (&tmp, clip->boxes, clip->num_boxes);
|
||||
status= _cairo_polygon_init_boxes (&intersect, &tmp);
|
||||
if (unlikely (status))
|
||||
goto cleanup_polygon;
|
||||
|
||||
status = _cairo_polygon_intersect (&polygon, fill_rule,
|
||||
&intersect, CAIRO_FILL_RULE_WINDING);
|
||||
_cairo_polygon_fini (&intersect);
|
||||
|
||||
if (unlikely (status))
|
||||
goto cleanup_polygon;
|
||||
|
||||
fill_rule = CAIRO_FILL_RULE_WINDING;
|
||||
}
|
||||
|
||||
polygon.limits = NULL;
|
||||
polygon.num_limits = 0;
|
||||
|
||||
antialias = clip_path->antialias;
|
||||
fill_rule = clip_path->fill_rule;
|
||||
clip_path = clip_path->prev;
|
||||
while (clip_path) {
|
||||
if (clip_path->antialias == antialias) {
|
||||
|
|
@ -353,26 +373,41 @@ fixup_unbounded_boxes (const cairo_spans_compositor_t *compositor,
|
|||
assert (status == CAIRO_INT_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
/* Now intersect with the clip boxes */
|
||||
if (extents->clip->num_boxes) {
|
||||
_cairo_boxes_init_for_array (&tmp,
|
||||
extents->clip->boxes,
|
||||
extents->clip->num_boxes);
|
||||
status = _cairo_boxes_intersect (&clear, &tmp, &clear);
|
||||
if (unlikely (status))
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* If we have a clip polygon, we need to intersect with that as well */
|
||||
if (extents->clip->path) {
|
||||
status = fixup_unbounded_polygon (compositor, extents, &clear);
|
||||
if (status == CAIRO_INT_STATUS_UNSUPPORTED)
|
||||
status = fixup_unbounded_mask (compositor, extents, &clear);
|
||||
} else {
|
||||
status = compositor->fill_boxes (extents->surface,
|
||||
CAIRO_OPERATOR_CLEAR,
|
||||
CAIRO_COLOR_TRANSPARENT,
|
||||
&clear);
|
||||
/* Otherwise just intersect with the clip boxes */
|
||||
if (extents->clip->num_boxes) {
|
||||
_cairo_boxes_init_for_array (&tmp,
|
||||
extents->clip->boxes,
|
||||
extents->clip->num_boxes);
|
||||
status = _cairo_boxes_intersect (&clear, &tmp, &clear);
|
||||
if (unlikely (status))
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (clear.is_pixel_aligned) {
|
||||
status = compositor->fill_boxes (extents->surface,
|
||||
CAIRO_OPERATOR_CLEAR,
|
||||
CAIRO_COLOR_TRANSPARENT,
|
||||
&clear);
|
||||
} else {
|
||||
cairo_composite_rectangles_t composite;
|
||||
|
||||
status = _cairo_composite_rectangles_init_for_boxes (&composite,
|
||||
extents->surface,
|
||||
CAIRO_OPERATOR_CLEAR,
|
||||
&_cairo_pattern_clear.base,
|
||||
&clear,
|
||||
NULL);
|
||||
if (likely (status == CAIRO_INT_STATUS_SUCCESS)) {
|
||||
status = composite_boxes (compositor, &composite, &clear);
|
||||
_cairo_composite_rectangles_fini (&composite);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
error:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue