summaryrefslogtreecommitdiff
path: root/src/cairo-bentley-ottmann-rectangular.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-08-02 14:38:50 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-08-05 09:48:14 +0100
commit5ab1eced5f82c9e54f171afe5bf9a2b72c778e71 (patch)
tree01811f33a52aab72b6517512fd3b181ce713d11d /src/cairo-bentley-ottmann-rectangular.c
parent0e135d9f5aa5402ac3566c1fdd1bd13f0e343946 (diff)
downloadcairo-5ab1eced5f82c9e54f171afe5bf9a2b72c778e71.tar.gz
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>
Diffstat (limited to 'src/cairo-bentley-ottmann-rectangular.c')
-rw-r--r--src/cairo-bentley-ottmann-rectangular.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/cairo-bentley-ottmann-rectangular.c b/src/cairo-bentley-ottmann-rectangular.c
index f55daacfc..a7506a9ba 100644
--- a/src/cairo-bentley-ottmann-rectangular.c
+++ b/src/cairo-bentley-ottmann-rectangular.c
@@ -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;
+ }
+ } 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;
- }
+ if (box.p1.x > box.p2.x) {
+ cairo_fixed_t tmp = box.p1.x;
+ box.p1.x = box.p2.x;
+ box.p2.x = tmp;
+ }
- status = _cairo_boxes_add (out, CAIRO_ANTIALIAS_DEFAULT, &box);
- assert (status == CAIRO_STATUS_SUCCESS);
+ _cairo_boxes_clear (out);
+ status = _cairo_boxes_add (out, CAIRO_ANTIALIAS_DEFAULT, &box);
+ assert (status == CAIRO_STATUS_SUCCESS);
+ }
return CAIRO_STATUS_SUCCESS;
}