[cairo-commit] 4 commits - ROADMAP src/cairo-path-stroke.c test/dash-caps-joins.c test/dash-caps-joins-ps-argb32-ref.png test/dash-caps-joins-ref.png test/degenerate-path.c test/degenerate-path-ps-argb32-ref.png test/degenerate-path-ref.png test/degenerate-path-rgb24-ref.png

Carl Worth cworth at kemper.freedesktop.org
Fri Aug 18 07:59:36 PDT 2006


 ROADMAP                                |    1 
 src/cairo-path-stroke.c                |    3 +
 test/dash-caps-joins-ps-argb32-ref.png |binary
 test/dash-caps-joins-ref.png           |binary
 test/dash-caps-joins.c                 |   57 +++++++++++++++++++--------------
 test/degenerate-path-ps-argb32-ref.png |binary
 test/degenerate-path-ref.png           |binary
 test/degenerate-path-rgb24-ref.png     |binary
 test/degenerate-path.c                 |   54 +++++++++++++++++++++++++------
 9 files changed, 81 insertions(+), 34 deletions(-)

New commits:
diff-tree 861f1cb4f70cdbd7702eaf642b999a21ad01037d (from parents)
Merge: c2d92d4397f7ed7a8b7fdfa24a4e339ecb0d6d69 fbb1758ba8384650157b2bbbc93d161b0c2a05f0
Author: Carl Worth <cworth at cworth.org>
Date:   Fri Aug 18 07:56:52 2006 -0700

    Merge branch 'jrmuizel-stroking-fixes' into cairo
    
    Conflicts:
    
    	test/dash-caps-joins-ps-argb32-ref.png
    	test/degenerate-path-ps-argb32-ref.png
    	test/degenerate-path.c

diff --cc ROADMAP
index 065e7f3,dd6c710..6a2eb0a
@@@ -29,16 -38,10 +29,17 @@@
  
  Themes and Schedules
  ====================
 -cairo-1.2 (April 2006): Better printing
 - - Supported PS/PDF output
 - - New, printing-oriented API
 - - Mozilla patches (device offset, push/pop_group)
 +cairo-1.2.4 (August 21, 2006): Fix build bugs with 1.2.2
 + - xlib detection requires libXt
 + - 7744: Compile troubles on AIX
 +✓- SVG backend requires PNG
 +✓- 7888: assertion failure with rotated bitmap glyphs
 +✓- 7889: cairo_text_path assertion failure on bitmap fonts
 +✓- Type1 on Windows (Adrian has a patch)
 +✓- source-clip-scale
 + - PS/PDF Type1/Type3 problem with rotated font_matrices
 +✓- close_path behavior (T Rowley's mail)
++✓- degenerate-path dashing fixes
  
  cairo-1.4 (October 2006): Better performance
   - New tessellator
diff --cc test/degenerate-path.c
index 964500f,3a8ba13..2c1e4c2
@@@ -43,7 -43,8 +43,8 @@@
  draw (cairo_t *cr, int width, int height)
  {
      const cairo_line_cap_t cap[] = { CAIRO_LINE_CAP_ROUND, CAIRO_LINE_CAP_SQUARE, CAIRO_LINE_CAP_BUTT };
 -    int i;
 +    size_t i;
+     double dash[] = {2, 2};
  
      cairo_set_source_rgb (cr, 1, 0, 0);
  
diff-tree fbb1758ba8384650157b2bbbc93d161b0c2a05f0 (from fdebc369d28f70ceba228d3131753225b2dbf844)
Author: Jeff Muizelaar <jeff at infidigm.net>
Date:   Sun Jun 25 16:12:38 2006 +0200

    Fix degenerate-path stroking with dashed lines.
    
    This draws dashed degenerate-paths if the dash is on at the point of the
    path and otherwise draws nothing.

diff --git a/src/cairo-path-stroke.c b/src/cairo-path-stroke.c
index 4ba321e..01dc3b4 100644
--- a/src/cairo-path-stroke.c
+++ b/src/cairo-path-stroke.c
@@ -699,6 +699,8 @@ _cairo_stroker_line_to_dashed (void *clo
     cairo_point_t *p2 = point;
     cairo_slope_t slope;
 
+    stroker->has_sub_path = stroker->dash_on;
+
     if (p1->x == p2->x && p1->y == p2->y)
 	return CAIRO_STATUS_SUCCESS;
 
@@ -758,6 +760,7 @@ _cairo_stroker_line_to_dashed (void *clo
 			    return status;
 		    }
 		}
+		stroker->has_sub_path = TRUE;
 	    }
 	    if (remain) {
 		/*
diff-tree fdebc369d28f70ceba228d3131753225b2dbf844 (from b607cdff98e621a6650bccef20f9877a0e7aa1d9)
Author: Jeff Muizelaar <jeff at infidigm.net>
Date:   Sun Jun 25 15:48:48 2006 +0200

    Modify degenerate-path test case to test dashed degenerate paths.

diff --git a/test/degenerate-path-ps-argb32-ref.png b/test/degenerate-path-ps-argb32-ref.png
index f16f0f6..b3cf1e9 100644
Binary files a/test/degenerate-path-ps-argb32-ref.png and b/test/degenerate-path-ps-argb32-ref.png differ
diff --git a/test/degenerate-path-ref.png b/test/degenerate-path-ref.png
index 1b07de4..82095fd 100644
Binary files a/test/degenerate-path-ref.png and b/test/degenerate-path-ref.png differ
diff --git a/test/degenerate-path-rgb24-ref.png b/test/degenerate-path-rgb24-ref.png
index 29f4089..54fff7f 100644
Binary files a/test/degenerate-path-rgb24-ref.png and b/test/degenerate-path-rgb24-ref.png differ
diff --git a/test/degenerate-path.c b/test/degenerate-path.c
index ab6a34d..3a8ba13 100644
--- a/test/degenerate-path.c
+++ b/test/degenerate-path.c
@@ -25,41 +25,75 @@
 
 #include "cairo-test.h"
 
-#define IMAGE_WIDTH 40
-#define IMAGE_HEIGHT 22
+#define PAD 3.0
+#define LINE_WIDTH 6.0
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
 
 static cairo_test_draw_function_t draw;
 
 cairo_test_t test = {
     "degenerate-path",
     "Tests the behaviour of degenerate paths with different cap types",
-    IMAGE_WIDTH, IMAGE_HEIGHT,
+    3*(PAD+LINE_WIDTH+PAD), 6*(LINE_WIDTH+PAD) + PAD,
     draw
 };
 
-#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
-
 static cairo_test_status_t
 draw (cairo_t *cr, int width, int height)
 {
     const cairo_line_cap_t cap[] = { CAIRO_LINE_CAP_ROUND, CAIRO_LINE_CAP_SQUARE, CAIRO_LINE_CAP_BUTT };
     int i;
+    double dash[] = {2, 2};
 
     cairo_set_source_rgb (cr, 1, 0, 0);
 
     for (i=0; i<ARRAY_SIZE(cap); i++) {
+	cairo_save (cr);
+
 	cairo_set_line_cap (cr, cap[i]);
 
-	cairo_set_line_width (cr, 6);
-	cairo_move_to (cr, 6, 6);
-	cairo_line_to (cr, 6, 6);
+	/* simple degenerate paths */
+	cairo_set_line_width (cr, LINE_WIDTH);
+	cairo_move_to (cr, LINE_WIDTH, LINE_WIDTH);
+	cairo_line_to (cr, LINE_WIDTH, LINE_WIDTH);
 	cairo_stroke (cr);
 
-	cairo_move_to (cr, 6, 15);
+	cairo_translate (cr, 0, 3*PAD);
+	cairo_move_to (cr, LINE_WIDTH, LINE_WIDTH);
 	cairo_close_path (cr);
 	cairo_stroke (cr);
 
-	cairo_translate (cr, 12, 0);
+	/* degenerate paths starting with dash on */
+	cairo_set_dash (cr, dash, 2, 0.);
+
+	cairo_translate (cr, 0, 3*PAD);
+	cairo_move_to (cr, LINE_WIDTH, LINE_WIDTH);
+	cairo_line_to (cr, LINE_WIDTH, LINE_WIDTH);
+	cairo_stroke (cr);
+
+	cairo_translate (cr, 0, 3*PAD);
+	cairo_move_to (cr, LINE_WIDTH, LINE_WIDTH);
+	cairo_close_path (cr);
+	cairo_stroke (cr);
+
+	/* degenerate paths starting with dash off */
+	/* these should not draw anything */
+	cairo_set_dash (cr, dash, 2, 2.);
+
+	cairo_translate (cr, 0, 3*PAD);
+	cairo_move_to (cr, LINE_WIDTH, LINE_WIDTH);
+	cairo_line_to (cr, LINE_WIDTH, LINE_WIDTH);
+	cairo_stroke (cr);
+
+	cairo_translate (cr, 0, 3*PAD);
+	cairo_move_to (cr, LINE_WIDTH, LINE_WIDTH);
+	cairo_close_path (cr);
+	cairo_stroke (cr);
+
+	cairo_restore (cr);
+
+	cairo_translate (cr, PAD+LINE_WIDTH+PAD, 0);
     }
     return CAIRO_TEST_SUCCESS;
 }
diff-tree b607cdff98e621a6650bccef20f9877a0e7aa1d9 (from c70edff0842bc6f7238e17a5fe92dddceec283d3)
Author: Jeff Muizelaar <jeff at freiheit.infidigm.net>
Date:   Sat Jul 15 14:39:26 2006 -0400

    Test closed dashed paths where the first and last sub-path do not join.
    
    This tests the situation reported by Keith Wells where the start point of a
    closed dashed path was not being properly capped.

diff --git a/test/dash-caps-joins-ps-argb32-ref.png b/test/dash-caps-joins-ps-argb32-ref.png
index 629b97b..974c281 100644
Binary files a/test/dash-caps-joins-ps-argb32-ref.png and b/test/dash-caps-joins-ps-argb32-ref.png differ
diff --git a/test/dash-caps-joins-ref.png b/test/dash-caps-joins-ref.png
index 9218ae4..ec1f2f7 100644
Binary files a/test/dash-caps-joins-ref.png and b/test/dash-caps-joins-ref.png differ
diff --git a/test/dash-caps-joins.c b/test/dash-caps-joins.c
index 722a59d..370d05d 100644
--- a/test/dash-caps-joins.c
+++ b/test/dash-caps-joins.c
@@ -41,7 +41,7 @@ cairo_test_t test = {
     "dash-caps-joins",
     "Test caps and joins when dashing",
     3 * (PAD + SIZE) + PAD,
-    PAD + SIZE + PAD,
+    PAD + SIZE + PAD + SIZE + PAD,
     draw
 };
 
@@ -62,6 +62,8 @@ static cairo_test_status_t
 draw (cairo_t *cr, int width, int height)
 {
     double dash[] = {LINE_WIDTH, 1.5 * LINE_WIDTH};
+    double dash_offset = -2 * LINE_WIDTH;
+    int i;
 
     /* We draw in the default black, so paint white first. */
     cairo_save (cr);
@@ -69,29 +71,36 @@ draw (cairo_t *cr, int width, int height
     cairo_paint (cr);
     cairo_restore (cr);
 
-    cairo_set_line_width (cr, LINE_WIDTH);
-    cairo_set_dash (cr, dash, sizeof(dash)/sizeof(dash[0]), - 2 * LINE_WIDTH);
-
-    cairo_translate (cr, PAD, PAD);
-
-    make_path (cr);
-    cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
-    cairo_set_line_join (cr, CAIRO_LINE_JOIN_BEVEL);
-    cairo_stroke (cr);
-
-    cairo_translate (cr, SIZE + PAD, 0.);
-
-    make_path (cr);
-    cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
-    cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
-    cairo_stroke (cr);
-
-    cairo_translate (cr, SIZE + PAD, 0.);
-
-    make_path (cr);
-    cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
-    cairo_set_line_join (cr, CAIRO_LINE_JOIN_MITER);
-    cairo_stroke (cr);
+    for (i=0; i<2; i++) {
+	cairo_save (cr);
+	cairo_set_line_width (cr, LINE_WIDTH);
+	cairo_set_dash (cr, dash, sizeof(dash)/sizeof(dash[0]), dash_offset);
+
+	cairo_translate (cr, PAD, PAD);
+
+	make_path (cr);
+	cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
+	cairo_set_line_join (cr, CAIRO_LINE_JOIN_BEVEL);
+	cairo_stroke (cr);
+
+	cairo_translate (cr, SIZE + PAD, 0.);
+
+	make_path (cr);
+	cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
+	cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
+	cairo_stroke (cr);
+
+	cairo_translate (cr, SIZE + PAD, 0.);
+
+	make_path (cr);
+	cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
+	cairo_set_line_join (cr, CAIRO_LINE_JOIN_MITER);
+	cairo_stroke (cr);
+
+	cairo_restore (cr);
+	cairo_translate (cr, 0., SIZE + PAD);
+	dash_offset = 0;
+    }
 
     return CAIRO_TEST_SUCCESS;
 }


More information about the cairo-commit mailing list