Bug 26010

Summary: cairo_line_to optimizes away path segments
Product: cairo Reporter: Alois <alois>
Component: generalAssignee: Carl Worth <cworth>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: critical    
Priority: high CC: alois
Version: 1.9.4   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Alois 2010-01-12 08:07:36 UTC
If I draw (with cairo_line_to() calls) a path which contains segments which
are draw twice, these segments are not rendered when the path is stroked.

Example:
cairo_move_to(1,1)
cairo_line_to(1,2);
cairo_line_to(2,3);
cairo_line_to(1,2);
cairo_stroke();

The same happens when I use rel_line_to().

This bug did not exist in cairo 1.8.8

Because of improved PDF handling I need to switch to a newer cairo version
than 1.8.8 and wouldbe very happy if this bug could be checked and fixed.

Thank you
Comment 1 Chris Wilson 2010-01-12 09:09:00 UTC
Thanks for the bug report!

commit 74ea4c908067f5579b51d3dbaea387da8f343671
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Jan 12 17:00:25 2010 +0000

    path: Do not remove anti-parallel line segments in case we are stroking
    
      Bug 26010 - cairo_line_to optimizes away path segments
      http://bugs.freedesktop.org/show_bug.cgi?id=26010
    
    As exercised by path-stroke-twice, we incorrectly optimise away a line
    segment if the path doubled back upon itself. This is very reminiscent
    of the optimisation bug for replacing curve-to with line-to.

commit a5dd5a6069c0d7435260a954d8d98483f5fbcc1c
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Jan 12 16:32:09 2010 +0000

    test: Add path-stroke-twice
    
    Exercises a bug found by alois@astro.ch, whereby we inadvertently remove
    a line segment when the path doubles back upon itself.
    
      Bug 26010 - cairo_line_to optimizes away path segments
      http://bugs.freedesktop.org/show_bug.cgi?id=26010
Comment 2 Alois 2010-01-12 14:35:23 UTC
Thanks for the very quick fix. I have backported the patch into my copy of 1.9.4 snapshot, it works fine now.

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.