bo-rectangular: handle in==out specifically for the single box case

In this case we do not need to copy anything, but may still need to
re-orientate the box.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2011-08-02 14:38:50 +01:00
parent 0e135d9f5a
commit 5ab1eced5f

View file

@ -739,18 +739,28 @@ _cairo_bentley_ottmann_tessellate_boxes (const cairo_boxes_t *in,
return CAIRO_STATUS_SUCCESS;
}
if (unlikely (in->num_boxes == 1)) {
cairo_box_t box = in->chunks.base[0];
_cairo_boxes_clear (out);
if (in->num_boxes == 1) {
if (in == out) {
cairo_box_t *box = &in->chunks.base[0];
if (box.p1.x > box.p2.x) {
cairo_fixed_t tmp = box.p1.x;
box.p1.x = box.p2.x;
box.p2.x = tmp;
if (box->p1.x > box->p2.x) {
cairo_fixed_t tmp = box->p1.x;
box->p1.x = box->p2.x;
box->p2.x = tmp;
}
} else {
cairo_box_t box = in->chunks.base[0];
if (box.p1.x > box.p2.x) {
cairo_fixed_t tmp = box.p1.x;
box.p1.x = box.p2.x;
box.p2.x = tmp;
}
_cairo_boxes_clear (out);
status = _cairo_boxes_add (out, CAIRO_ANTIALIAS_DEFAULT, &box);
assert (status == CAIRO_STATUS_SUCCESS);
}
status = _cairo_boxes_add (out, CAIRO_ANTIALIAS_DEFAULT, &box);
assert (status == CAIRO_STATUS_SUCCESS);
return CAIRO_STATUS_SUCCESS;
}