[cairo-commit] src/cairo-pen.c test/reference

Chris Wilson ickle at kemper.freedesktop.org
Wed Oct 31 02:33:46 PDT 2012


 src/cairo-pen.c                         |   60 +++++++++++++++++---------------
 test/reference/arc-looping-dash.ref.png |binary
 test/reference/caps-tails-curve.ref.png |binary
 test/reference/reflected-stroke.ref.png |binary
 4 files changed, 32 insertions(+), 28 deletions(-)

New commits:
commit d7f5a1bec421d6c7b92d16daae681fa31ac7c212
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Oct 31 09:27:52 2012 +0000

    pen: First check whether the in/out edges lie within the single pen vertex
    
    In order to prevent underflow when searching for the closing pen vertex,
    we first need to be sure that it does not simply lie next to the opening
    pen vertex. As a result we were missing many cases that should have been
    a bevel (in == out) and generating almost complete round caps instead.
    
    Reported-by: Dominik Röttsches <dominik.rottsches at intel.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=56432
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-pen.c b/src/cairo-pen.c
index ea9e36a..b4b643c 100644
--- a/src/cairo-pen.c
+++ b/src/cairo-pen.c
@@ -412,21 +412,23 @@ _cairo_pen_find_active_cw_vertices (const cairo_pen_t *pen,
 	    i = 0;
     *start = i;
 
-    lo = i;
-    hi = i + pen->num_vertices;
-    i = (lo + hi) >> 1;
-    do {
-	int j = i;
-	if (j >= pen->num_vertices)
-	    j -= pen->num_vertices;
-	if (_cairo_slope_compare (&pen->vertices[j].slope_cw, out) > 0)
-	    hi = i;
-	else
-	    lo = i;
+    if (_cairo_slope_compare (out, &pen->vertices[i].slope_ccw) > 0) {
+	lo = i;
+	hi = i + pen->num_vertices;
 	i = (lo + hi) >> 1;
-    } while (hi - lo > 1);
-    if (i >= pen->num_vertices)
-	i -= pen->num_vertices;
+	do {
+	    int j = i;
+	    if (j >= pen->num_vertices)
+		j -= pen->num_vertices;
+	    if (_cairo_slope_compare (&pen->vertices[j].slope_cw, out) > 0)
+		hi = i;
+	    else
+		lo = i;
+	    i = (lo + hi) >> 1;
+	} while (hi - lo > 1);
+	if (i >= pen->num_vertices)
+	    i -= pen->num_vertices;
+    }
     *stop = i;
 }
 
@@ -452,20 +454,22 @@ _cairo_pen_find_active_ccw_vertices (const cairo_pen_t *pen,
 	    i = 0;
     *start = i;
 
-    lo = i;
-    hi = i + pen->num_vertices;
-    i = (lo + hi) >> 1;
-    do {
-	int j = i;
-	if (j >= pen->num_vertices)
-	    j -= pen->num_vertices;
-	if (_cairo_slope_compare (out, &pen->vertices[j].slope_ccw) > 0)
-	    hi = i;
-	else
-	    lo = i;
+    if (_cairo_slope_compare (&pen->vertices[i].slope_cw, out) < 0) {
+	lo = i;
+	hi = i + pen->num_vertices;
 	i = (lo + hi) >> 1;
-    } while (hi - lo > 1);
-    if (i >= pen->num_vertices)
-	i -= pen->num_vertices;
+	do {
+	    int j = i;
+	    if (j >= pen->num_vertices)
+		j -= pen->num_vertices;
+	    if (_cairo_slope_compare (out, &pen->vertices[j].slope_ccw) > 0)
+		hi = i;
+	    else
+		lo = i;
+	    i = (lo + hi) >> 1;
+	} while (hi - lo > 1);
+	if (i >= pen->num_vertices)
+	    i -= pen->num_vertices;
+    }
     *stop = i;
 }
diff --git a/test/reference/arc-looping-dash.ref.png b/test/reference/arc-looping-dash.ref.png
index 6d0c5cf..516e66c 100644
Binary files a/test/reference/arc-looping-dash.ref.png and b/test/reference/arc-looping-dash.ref.png differ
diff --git a/test/reference/caps-tails-curve.ref.png b/test/reference/caps-tails-curve.ref.png
index f23d5dc..ac97c82 100644
Binary files a/test/reference/caps-tails-curve.ref.png and b/test/reference/caps-tails-curve.ref.png differ
diff --git a/test/reference/reflected-stroke.ref.png b/test/reference/reflected-stroke.ref.png
index 1318806..c05eb96 100644
Binary files a/test/reference/reflected-stroke.ref.png and b/test/reference/reflected-stroke.ref.png differ


More information about the cairo-commit mailing list