Bug 45249 - Add cubic curve classifier
Summary: Add cubic curve classifier
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Kenneth Russell
URL:
Keywords:
Depends on:
Blocks: 44729
  Show dependency treegraph
 
Reported: 2010-09-05 22:20 PDT by Kenneth Russell
Modified: 2010-09-09 12:40 PDT (History)
9 users (show)

See Also:


Attachments
Patch (9.08 KB, patch)
2010-09-05 22:37 PDT, Kenneth Russell
jamesr: review-
kbr: commit-queue-
Details | Formatted Diff | Diff
Revised patch (8.95 KB, patch)
2010-09-08 18:28 PDT, Kenneth Russell
jamesr: review+
kbr: commit-queue-
Details | Formatted Diff | Diff
Revised patch (9.13 KB, patch)
2010-09-09 11:54 PDT, Kenneth Russell
jamesr: review+
kbr: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kenneth Russell 2010-09-05 22:20:58 PDT
As part of the GPU accelerated path rendering algorithm being added in https://bugs.webkit.org/show_bug.cgi?id=44729 , the code which classifies cubic curves needs to be integrated.
Comment 1 Kenneth Russell 2010-09-05 22:37:35 PDT
Created attachment 66608 [details]
Patch

From the ChangeLog:

Adding the cubic curve classification algorithm per the GPU Gems 3 chapter. No tests yet; will be tested in conjunction with later code.
Comment 2 James Robinson 2010-09-08 13:40:23 PDT
Comment on attachment 66608 [details]
Patch

Looks good overall, r- for the nits below.

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

> WebCore/platform/graphics/gpu/LoopBlinnClassifier.cpp:42
> +LoopBlinnClassifier::Result LoopBlinnClassifier::classify(const FloatPoint& c0,
> +                                                          const FloatPoint& c1,
> +                                                          const FloatPoint& c2,
> +                                                          const FloatPoint& c3)
> +{
> +    // Consult the chapter for the definitions of the following
> +    // (terse) variable names.
Could we add a link to the algorithm itself somewhere?

> WebCore/platform/graphics/gpu/LoopBlinnClassifier.cpp:74
> +    float discr = d1 * d1 * term0;
This should be discriminant.

> WebCore/platform/graphics/gpu/LoopBlinnClassifier.cpp:84
> +    d1 = roundToZero(d1);
> +    d2 = roundToZero(d2);
> +    d3 = roundToZero(d3);
> +    discr = roundToZero(discr);
Have these declare the namespace explicitly.

> WebCore/platform/graphics/gpu/LoopBlinnClassifier.h:63
> +        float d1() const { return m_d1; }
> +        float d2() const { return m_d2; }
> +        float d3() const { return m_d3; }
Please add a comment indicating what these mean.
Comment 3 Kenneth Russell 2010-09-08 18:28:46 PDT
Created attachment 66984 [details]
Revised patch

Addressed code review feedback above.
Comment 4 Kenneth Russell 2010-09-08 18:29:51 PDT
Comment on attachment 66608 [details]
Patch

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

> WebCore/platform/graphics/gpu/LoopBlinnClassifier.cpp:42
> +    // (terse) variable names.
Added link in the header.

> WebCore/platform/graphics/gpu/LoopBlinnClassifier.cpp:74
> +    float discr = d1 * d1 * term0;
Done.

> WebCore/platform/graphics/gpu/LoopBlinnClassifier.cpp:84
> +    discr = roundToZero(discr);
Now explicitly using the functions from LoopBlinnMathUtils.

> WebCore/platform/graphics/gpu/LoopBlinnClassifier.h:63
> +        float d3() const { return m_d3; }
Done.
Comment 5 James Robinson 2010-09-08 19:57:18 PDT
Comment on attachment 66984 [details]
Revised patch

Cool!  R=me

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

> WebCore/platform/graphics/gpu/LoopBlinnClassifier.cpp:90
> +    if (approxEqual(b0, b1)
> +        && approxEqual(b0, b2)
> +        && approxEqual(b0, b3)) {
nit: this could be on one line
Comment 6 Kenneth Russell 2010-09-09 11:54:18 PDT
Created attachment 67074 [details]
Revised patch

It turns out that while converting this code to use FloatPoint3D I introduced a regression; the 2D points are considered to be homogeneous, meaning that during conversion to 3D their "z" coordinate (actually the "w" coordinate in an (x, y, w) triplet) needs to be set to 1.0. Please re-review. Also fixed formatting nit above.
Comment 7 WebKit Review Bot 2010-09-09 11:58:11 PDT
Attachment 67074 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style']" exit_code: 1
WebCore/platform/graphics/gpu/LoopBlinnClassifier.cpp:92:  One line control clauses should not use braces.  [whitespace/braces] [4]
Total errors found: 1 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 8 James Robinson 2010-09-09 12:21:46 PDT
Comment on attachment 67074 [details]
Revised patch

The style error is legit, please fix.

Otherwise R=me
Comment 9 Kenneth Russell 2010-09-09 12:31:39 PDT
(In reply to comment #8)
> (From update of attachment 67074 [details])
> The style error is legit, please fix.

Will fix upon landing.
Comment 10 Kenneth Russell 2010-09-09 12:40:11 PDT
Committed r67103: <http://trac.webkit.org/changeset/67103>