Bug 54658

Summary: [gtk] Failing collinear arcTo canvas tests
Product: WebKit Reporter: Zan Dobersek <zan>
Component: CanvasAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, eric, krit, mdelaney7, mrobinson, oliver
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Bug Depends on:    
Bug Blocks: 54458    
Attachments:
Description Flags
Add collinearity check
mrobinson: review-
Updated patch none

Description Zan Dobersek 2011-02-17 07:23:12 PST
The following two canvas tests are failing because we do not check for collinearity of the points when arcTo is called.
canvas/philip/tests/2d.path.arcTo.collinear.2.html
canvas/philip/tests/2d.path.arcTo.collinear.3.html
Comment 1 Zan Dobersek 2011-02-17 07:31:38 PST
Created attachment 82798 [details]
Add collinearity check

This patch adds a collinearity check that checks if the three points used to draw an arc through arcTo method are positioned in a line.

Check is performed by calculating the area of the triangle that the three points construct - if the area equals zero, the lines are collinear.
Comment 2 Martin Robinson 2011-02-17 15:34:53 PST
Comment on attachment 82798 [details]
Add collinearity check

View in context: https://bugs.webkit.org/attachment.cgi?id=82798&action=review

This is great! We want to make the if statement a little clearer below.

> Source/WebCore/platform/graphics/cairo/PathCairo.cpp:187
> +        || !(p0.x() * (p1.y() - p2.y()) + p1.x() * (p2.y() - p0.y()) + p2.x() * (p0.y() - p1.y()))) {

Please split out the area calculation to a static inline method called something like areaOfTriangleFormedByPoints.
Comment 3 Zan Dobersek 2011-02-18 10:09:44 PST
Created attachment 82974 [details]
Updated patch

Creates new function for calculating area of a triangle, clears up the checking statement.
Comment 4 Eric Seidel (no email) 2011-02-24 03:18:39 PST
Comment on attachment 82974 [details]
Updated patch

OK.  rs=me.
Comment 5 Eric Seidel (no email) 2011-02-24 03:19:15 PST
CCing folks who understand graphics better than I so they can see this go by.
Comment 6 WebKit Commit Bot 2011-02-24 03:51:43 PST
Comment on attachment 82974 [details]
Updated patch

Clearing flags on attachment: 82974

Committed r79541: <http://trac.webkit.org/changeset/79541>
Comment 7 WebKit Commit Bot 2011-02-24 03:51:47 PST
All reviewed patches have been landed.  Closing bug.