Bug 4863

Summary: stroking problems with wide dashed lines
Product: cairo Reporter: Matthias Clasen <mclasen>
Component: generalAssignee: Carl Worth <cworth>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: high    
Version: 1.1.1   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: test case
Test case suitable for cairo/test suite
Test case suitable for cairo/test suite
Image of the current buggy behavior
Fixes the bug causing the leaky dash problem

Description Matthias Clasen 2005-10-24 11:42:19 UTC
I see these when drawing focus rectangles in gtk with line width > 1.
Not sure if the line width is a hard requirement for the bug.

I'll attach a small gtk example showing the problem
Comment 1 Matthias Clasen 2005-10-24 11:42:54 UTC
Created attachment 3615 [details]
test case
Comment 2 Carl Worth 2005-10-25 13:03:34 UTC
Created attachment 3628 [details]
Test case suitable for cairo/test suite

I've successfully replicated the bug (thanks for the nice test case).

Here's a slightly simpler version of the test case ready to drop into the test
suite in cairo/test.
Comment 3 Carl Worth 2005-10-25 14:11:04 UTC
Created attachment 3630 [details]
Test case suitable for cairo/test suite

I've successfully replicated the bug (thanks for the nice test case).

Here's a slightly simpler version of the test case ready to drop into the test
suite in cairo/test.
Comment 4 Carl Worth 2005-10-25 14:12:03 UTC
Comment on attachment 3630 [details]
Test case suitable for cairo/test suite

Sorry about that. Came back after lunch and thought I hadn't clicked submit
yet. :-}
Comment 5 Carl Worth 2005-11-08 09:46:44 UTC
Created attachment 3738 [details]
Image of the current buggy behavior
Comment 6 Behdad Esfahbod 2006-03-16 02:21:45 UTC
I see this is in ROADMAP for 1.0.4, no patch though.
Comment 7 Carl Worth 2006-03-16 02:30:04 UTC
(In reply to comment #6)
> I see this is in ROADMAP for 1.0.4, no patch though.

Wee need to get 1.0.4 out for the gcc 4.0 compilation fixes and the zero-sized
glyph fix. Why don't we just slip this known bug out to the 1.0.6 ROADMAP.

-Carl
Comment 8 Carl Worth 2006-04-27 04:09:29 UTC
We didn't mean to close this. The bug certainly isn't fixed yet, (we were just
trying to slip it out past 1.0.4).
Comment 9 Jeff Smith 2007-02-05 15:45:21 UTC
This is the problem as it applies to the test case.  The first segment starts with dash_on set to 0, so first_face should not be set at all for the path.  However, the segment starting at the lower right corner starts at the same point that dash_on is going from 0 to 1, and so gets set as first_face.  At the end of the closing line, current_face is set.  With both first_face set (at the lower right) and current_face set (at the upper left), a join is attempted.  This results in the big wedge.
Comment 10 Jeff Smith 2007-02-05 15:45:40 UTC
Created attachment 8604 [details] [review]
Fixes the bug causing the leaky dash problem

In the cairo test suite: fixes leaky-dash, no other changes.
Comment 11 Behdad Esfahbod 2007-02-20 12:23:58 UTC
Fix is pushed now and will be in 1.4.

commit afd5f92195335a88d7c1ff181a1bd03ca01b424f
Author: Jeff Muizelaar <jrmuizel@uwaterloo.ca>
Date:   Mon Feb 19 16:06:57 2007 -0500

    Fix several issues with dashed stroking code, particularly 'leaky-dash'
    
    Adds some state, 'dash_starts_on', to keep track of whether a dashed path
    starts with dash_on or not. This fixes the 'leaky-dash' bug (#4863) and
    some other degenerate cases. The new version is, in my opinion,
    considerably cleaner and more understandable than the old code.
    
    Finally, the rewrite changes the behaviour of dashing to add degenerate
    caps around corners that start at the same place as a dash begins. This
    matches the behaviour seen in acroread.
    
    This rewrite is based on an initial rewrite done by Jeff Smith.

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.