Bug 2729

Summary: Negative dash offsets
Product: cairo Reporter: Owen Taylor <otaylor>
Component: generalAssignee: Carl Worth <cworth>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: high CC: jwatt
Version: 0.9.3   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Test case
Current output
Test case and fix, ready for CVS.

Description Owen Taylor 2005-03-14 14:33:57 UTC
Negative dash offsets work strangely ... instead of treating the 
dash pattern as infinitely repeating in both directions, patterns
of the pattern less than 0 are consider to be all on.

E.g. a 1,1 dash with an offset of 5 gives [6,1,1,1,1,1]

The test case attached also reveals something else that suprised me ..
a 1,1 dash offset by 50% gives a noticeably striated result. But
thinking about it, that's a consequence of the subsampling algorithm
The values are 120 and 135 out of 255 ... e.g, +/- a sample column.
Comment 1 Owen Taylor 2005-03-14 14:35:06 UTC
Created attachment 2106 [details]
Test case

Test case for test/
Comment 2 Owen Taylor 2005-03-14 14:35:39 UTC
Created attachment 2107 [details]
Current output
Comment 3 Carl Worth 2005-08-19 10:53:17 UTC
Created attachment 2930 [details] [review]
Test case and fix, ready for CVS.
Comment 4 Carl Worth 2005-08-19 12:02:19 UTC
2005-08-19  Carl Worth  <cworth@cworth.org>

        Fix for bug #2729:

        * src/cairo-gstate.c: (_cairo_gstate_set_dash): Adjust negative
        offsets up to their equivalent positive value. Add error checking
        for dash values, (must each be non-negative and must not be all
        zero).

        * src/cairo.c (cairo_set_dash): Add documentation.

        * src/cairo.h:
        * src/cairo.c: (cairo_status_to_string): Add new
        CAIRO_STATUS_INVALID_DASH.

        * test/.cvsignore:
        * test/Makefile.am: Add dash-offfset-negative test from Owen.

        * doc/public/tmpl/cairo.sgml: churn
Comment 5 Carl Worth 2005-08-22 17:14:35 UTC
Move bugs against "cvs" version to "0.9.3" so we can remove the "cvs" version.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.