[cairo-commit] 2 commits - src/cairo-arc.c test/bug-84115.c test/Makefile.sources test/reference

Chris Wilson ickle at kemper.freedesktop.org
Wed Sep 24 04:36:13 PDT 2014


 src/cairo-arc.c                       |    4 ++
 test/Makefile.sources                 |    1 
 test/bug-84115.c                      |   61 ++++++++++++++++++++++++++++++++++
 test/reference/bug-84115.ref.png      |binary
 test/reference/bug-84115.xlib.ref.png |binary
 5 files changed, 66 insertions(+)

New commits:
commit 80359e73d821516f411b25b977b442869fa5d0ad
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Sep 23 12:58:27 2014 +0100

    test: Exercise stroking bugs with xlib/trapezoids
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84115
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/test/Makefile.sources b/test/Makefile.sources
index 689645c..7e80b90 100644
--- a/test/Makefile.sources
+++ b/test/Makefile.sources
@@ -26,6 +26,7 @@ test_sources = \
 	bilevel-image.c					\
 	bug-40410.c					\
 	bug-51910.c					\
+	bug-84115.c					\
 	bug-bo-rectangular.c				\
 	bug-bo-collins.c				\
 	bug-bo-ricotz.c					\
diff --git a/test/bug-84115.c b/test/bug-84115.c
new file mode 100644
index 0000000..4db113c
--- /dev/null
+++ b/test/bug-84115.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright © 2011 Krzysztof Kosiński
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Author: Krzysztof Kosiński <tweenk.pl at gmail.com>
+ */
+
+#include "cairo-test.h"
+
+#define WIDTH	800
+#define HEIGHT	800
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+    double lw = 800;
+    int n = 0;
+
+    cairo_set_source_rgb (cr, 1,1,1);
+    cairo_paint (cr);
+
+    cairo_set_source_rgba (cr, 0, 0, 0, .4);
+    cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
+    do {
+	cairo_set_line_width(cr, lw);
+	cairo_arc(cr, WIDTH/2, HEIGHT/2, lw/2,
+		  2*M_PI*(13*n + 1) / 130, 2*M_PI*(13*n + 12) / 130);
+	cairo_stroke(cr);
+
+	n++;
+	lw /= 1.1;
+    } while (lw > 0.5);
+
+    return CAIRO_TEST_SUCCESS;
+}
+
+CAIRO_TEST (bug_84115,
+	    "Exercises a bug found in stroke generation using trapezoids",
+	    "stroke", /* keywords */
+	    NULL, /* requirements */
+	    WIDTH, HEIGHT,
+	    NULL, draw)
diff --git a/test/reference/bug-84115.ref.png b/test/reference/bug-84115.ref.png
new file mode 100644
index 0000000..f249ba5
Binary files /dev/null and b/test/reference/bug-84115.ref.png differ
diff --git a/test/reference/bug-84115.xlib.ref.png b/test/reference/bug-84115.xlib.ref.png
new file mode 100644
index 0000000..2e17a65
Binary files /dev/null and b/test/reference/bug-84115.xlib.ref.png differ
commit 06a737b74d3bc925a2c32254f497e07b6d1af5ca
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Sep 24 09:57:31 2014 +0100

    arc: Insert the initial point on the arc
    
    Currently the very first point on the arc will be the first interpreted
    location along the spline used to approximate the arc. This will be
    close, but not quite the exact point the user intended the arc to run
    from, so begin the arc with a line-to the initial point.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-arc.c b/src/cairo-arc.c
index 5cbd112..390397b 100644
--- a/src/cairo-arc.c
+++ b/src/cairo-arc.c
@@ -236,6 +236,10 @@ _cairo_arc_in_direction (cairo_t	  *cr,
 	    step = -step;
 	}
 
+	cairo_line_to (cr,
+		       xc + radius * cos (angle_min),
+		       yc + radius * sin (angle_min));
+
 	for (i = 0; i < segments; i++, angle_min += step) {
 	    _cairo_arc_segment (cr, xc, yc, radius,
 				angle_min, angle_min + step);


More information about the cairo-commit mailing list