Bug 54658 - [gtk] Failing collinear arcTo canvas tests
Summary: [gtk] Failing collinear arcTo canvas tests
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Canvas (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 54458
  Show dependency treegraph
 
Reported: 2011-02-17 07:23 PST by Zan Dobersek
Modified: 2011-02-24 03:51 PST (History)
6 users (show)

See Also:


Attachments
Add collinearity check (2.92 KB, patch)
2011-02-17 07:31 PST, Zan Dobersek
mrobinson: review-
Details | Formatted Diff | Diff
Updated patch (3.43 KB, patch)
2011-02-18 10:09 PST, Zan Dobersek
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.