Bug 53841

Summary: Rectangle drawn incorrectly when it has zero height and miter limit morethan 1.414
Product: cairo Reporter: Sudarsana Nagineni <sudarsana.nagineni>
Component: generalAssignee: Carl Worth <cworth>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium    
Version: 1.10.2   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: example, highlights the error

Description Sudarsana Nagineni 2012-08-20 12:22:04 UTC
Created attachment 65828 [details]
example, highlights the error

Test case http://philip.html5.org/tests/canvas/suite/tests/2d.path.rect.zero.6.html is failing on browser ports using Cairo(Firefox, Webkit GTK/EFL). The problem can be seen more clearly with the attached example.

Example draws a rectangle from (100,25) to (500,25) and expects it not to draw anything in the region (0,0)-(100,50) since the height zero. But, the test is failing because the rectangle is getting expanded by half the line width and drawn incorrectly at x < 100. 

https://bugzilla.mozilla.org/show_bug.cgi?id=407107 has some insight about the issue.
Comment 1 Chris Wilson 2012-08-20 12:37:15 UTC
Test case:

commit 2a0d81743270aaff29e8951c896cde644fd4e576
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Aug 20 13:34:33 2012 +0100

    tests: Add outline-tolerance
    
    From https://bugs.freedesktop.org/show_bug.cgi?id=53841:
    
    "Rectangle drawn incorrectly when it has zero height
    and miter limit greater than 1.414"
Comment 2 Chris Wilson 2012-08-20 13:27:18 UTC
commit ee7f5607192a3341df45199b1c7c8996f2b7347d
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Aug 20 14:21:23 2012 +0100

    stroker: Avoid emitting a miter join for across an elided degenerate segment
    
    Given the criteria of the rectlinear stroker that it only handles
    horizontal and vertical line segments, and eliminates degenerate
    segments before stroking, we must be careful not to apply a join between
    two horizontal segments (for example if the intervening vertical segment
    was degenerate and so elided). A miter join between two colinear
    segments is empty, yet we were blissfully extending the line caps to
    cover the join.
    
    Fixes: outline-tolerance
    Bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=407107
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

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.