[cairo-commit] src/cairo-bentley-ottmann-rectangular.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Jun 8 02:00:17 PDT 2011


 src/cairo-bentley-ottmann-rectangular.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 6edc5ca55f35a3705ef324b78b4d10183df9d4af
Author: Taekyun Kim <tkq.kim at samsung.com>
Date:   Wed Jun 8 13:05:54 2011 +0900

    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 at chris-wilson.co.uk>

diff --git a/src/cairo-bentley-ottmann-rectangular.c b/src/cairo-bentley-ottmann-rectangular.c
index f2f790e..88986bb 100644
--- a/src/cairo-bentley-ottmann-rectangular.c
+++ b/src/cairo-bentley-ottmann-rectangular.c
@@ -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;


More information about the cairo-commit mailing list