mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 13:28:03 +02:00
tessellator: Fix boxes tessellator to handle num_boxes <= 1 correctly
We cannot assume that parameter 'out' is empty. So we should make it empty before returning CAIRO_STATUS_SUCCESS when 'in' contains no boxes. When 'in' contains a single box, we should copy 'in' to 'out' rather than just returning CAIRO_STATUS_SUCCESS. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
27d26bb8b5
commit
6edc5ca55f
1 changed files with 11 additions and 1 deletions
|
|
@ -731,8 +731,18 @@ _cairo_bentley_ottmann_tessellate_boxes (const cairo_boxes_t *in,
|
|||
cairo_status_t status;
|
||||
int i, j;
|
||||
|
||||
if (unlikely (in->num_boxes <= 1))
|
||||
if (unlikely (in->num_boxes == 0)) {
|
||||
_cairo_boxes_clear (out);
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (unlikely (in->num_boxes == 1)) {
|
||||
cairo_box_t box = in->chunks.base[0];
|
||||
_cairo_boxes_clear (out);
|
||||
status = _cairo_boxes_add (out, &box);
|
||||
assert (status == CAIRO_STATUS_SUCCESS);
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
rectangles = stack_rectangles;
|
||||
rectangles_ptrs = stack_rectangles_ptrs;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue