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

Carl Worth cworth at kemper.freedesktop.org
Mon Apr 10 11:03:38 PDT 2006


 src/cairo-path-stroke.c                |   12 +++++++++++-
 test/dash-caps-joins-ps-argb32-ref.png |binary
 test/dash-caps-joins-ref.png           |binary
 test/dash-caps-joins-rgb24-ref.png     |binary
 4 files changed, 11 insertions(+), 1 deletion(-)

New commits:
diff-tree 08b109fb9a8c54f4764fe7a94ce7833e832bc157 (from 65e706ee14b9bfbc2ce0e83b35a813d51d97592f)
Author: Carl Worth <cworth at raht.cworth.org>
Date:   Mon Apr 10 11:00:26 2006 -0700

    Add new ps-specific reference image for dash-caps-joins test.
    
    With the recent fix to the treatment of sub-paths with respect to
    dashing, this test is now correct except for slight difference in
    ghostscript vs. cairo rasterization. This commit records the
    ghostscript output as the new reference image against which the ps
    output should be tested.

diff --git a/test/dash-caps-joins-ps-argb32-ref.png b/test/dash-caps-joins-ps-argb32-ref.png
new file mode 100644
index 0000000..629b97b
Binary files /dev/null and b/test/dash-caps-joins-ps-argb32-ref.png differ
diff-tree 65e706ee14b9bfbc2ce0e83b35a813d51d97592f (from f02aacbb5f8068f6b0101b3200bd3a0d73746dd4)
Author: Jeff Muizelaar <jeff at infidigm.net>
Date:   Sun Apr 9 23:13:36 2006 -0400

    Reset dashing for new subpaths.
    
    Fixes the bug mentioned in b87726ee2aa0220b66ee4d97513c0ac89ffc4621 by reseting
    the dash pattern for each new subpath. This is correct behaviour according to
    the end of PDF Reference v1.6 section 4.3.2.
    
    This commit now makes the dash-caps-joins test case pass for all
    backends except for the PostScript backend.

diff --git a/src/cairo-path-stroke.c b/src/cairo-path-stroke.c
index 96664ce..a02a3aa 100644
--- a/src/cairo-path-stroke.c
+++ b/src/cairo-path-stroke.c
@@ -616,6 +616,16 @@ _cairo_stroker_move_to (void *closure, c
 }
 
 static cairo_status_t
+_cairo_stroker_move_to_dashed (void *closure, cairo_point_t *point)
+{
+    /* reset the dash pattern for new sub paths */
+    cairo_stroker_t *stroker = closure;
+    _cairo_stroker_start_dash (stroker);
+
+    return _cairo_stroker_move_to (closure, point);
+}
+
+static cairo_status_t
 _cairo_stroker_line_to (void *closure, cairo_point_t *point)
 {
     cairo_status_t status;
@@ -954,7 +964,7 @@ _cairo_path_fixed_stroke_to_traps (cairo
     if (stroker.style->dash)
 	status = _cairo_path_fixed_interpret (path,
 					      CAIRO_DIRECTION_FORWARD,
-					      _cairo_stroker_move_to,
+					      _cairo_stroker_move_to_dashed,
 					      _cairo_stroker_line_to_dashed,
 					      _cairo_stroker_curve_to_dashed,
 					      _cairo_stroker_close_path,
diff-tree f02aacbb5f8068f6b0101b3200bd3a0d73746dd4 (from 807f64d57c616e2ce8a61202cd9b59ac7a6a26cb)
Author: Carl Worth <cworth at raht.cworth.org>
Date:   Mon Apr 10 10:54:24 2006 -0700

    Update dash-caps-joins test cases to show independent dashing of sub-paths.
    
    We would like to be compatible with PostScript/PDF dash semantics. And
    according to the description of the setdash operator in section 8.2 of
    the PostScript Language Reference Manual, (as well as the description
    of the line dash pattern in section 4.3.2 of the PDF Reference), each
    sub-path should be treated independently with respect to dashing.
    
    With this change, this test now fails for most backends for which it
    previously passed.

diff --git a/test/dash-caps-joins-ref.png b/test/dash-caps-joins-ref.png
index 5c887c5..9218ae4 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-rgb24-ref.png b/test/dash-caps-joins-rgb24-ref.png
index 28339f8..6ec274d 100644
Binary files a/test/dash-caps-joins-rgb24-ref.png and b/test/dash-caps-joins-rgb24-ref.png differ


More information about the cairo-commit mailing list