Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Issue 558163005: thick stroke Beziers (Closed)

Created:
6 years, 3 months ago by caryclark
Modified:
6 years, 2 months ago
Reviewers:
schenney, brittanyrodriguez405, fmalita_google_do_not_use, reed1
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/skia.git@master
Project:
skia
Visibility:
Public.

Description

Draw more accurate thick-stroked Beziers (disabled) Draw thick-stroked Beziers by computing the outset quadratic, measuring the error, and subdividing until the error is within a predetermined limit. To try this CL out, change src/core/SkStroke.h:18 to #define QUAD_STROKE_APPROXIMATION 1 or from the command line: CPPFLAGS="-D QUAD_STROKE_APPROXIMATION=1" ./gyp_skia Here's what's in this CL: bench/BezierBench.cpp : a microbench for examining where the time is going gm/beziers.cpp : random Beziers with various thicknesses gm/smallarc.cpp : a distillation of bug skia:2769 samplecode/SampleRotateCircles.cpp : controls added for error, limit, width src/core/SkStroke.cpp : the new stroke implementation (disabled) tests/StrokerTest.cpp : a stroke torture test that checks normal and extreme values The new stroke algorithm has a tweakable parameter: stroker.setError(1); (SkStrokeRec.cpp:112) The stroke error is the allowable gap between the midpoint of the stroke quadratic and the center Bezier. As the projection from the quadratic approaches the endpoints, the error is decreased proportionally so that it is always inside the quadratic curve. An overview of how this works: - For a given T range of a Bezier, compute the perpendiculars and find the points outset and inset for some radius. - Construct tangents for the quadratic stroke. - If the tangent don't intersect between them (may happen with cubics), subdivide. - If the quadratic stroke end points are close (again, may happen with cubics), draw a line between them. - Compute the quadratic formed by the intersecting tangents. - If the midpoint of the quadratic is close to the midpoint of the Bezier perpendicular, return the quadratic. - If the end of the stroke at the Bezier midpoint doesn't intersect the quad's bounds, subdivide. - Find where the Bezier midpoint ray intersects the quadratic. - If the intersection is too close to the quad's endpoints, subdivide. - If the error is large proportional to the intersection's distance to the quad's endpoints, subdivide. BUG=skia:723, skia:2769 Committed: https://skia.googlesource.com/skia/+/feff7d2d7719f52c7ea52db156003e609002bf04

Patch Set 1 #

Patch Set 2 : new stroke somewhat working #

Patch Set 3 : refactor cubic and quad stroking; fix sample #

Patch Set 4 : add new gm and bench tests #

Patch Set 5 : remove duplicate point calculations #

Patch Set 6 : fix function camel case #

Patch Set 7 : factor out tangent ray #

Patch Set 8 : revert unrelated changes #

Patch Set 9 : merge sampleapp debugging branch #

Patch Set 10 : move stack depth debug variable into quad condition #

Patch Set 11 : fix linux build #

Patch Set 12 : fix degenerate case with no tangent at end #

Patch Set 13 : save work in progress (not for review) #

Patch Set 14 : add more tests #

Patch Set 15 : stroke work in progress -- not for review #

Patch Set 16 : stroke work in progress (not for review) #

Patch Set 17 : quads work well; more to do on cubics #

Patch Set 18 : cubic stroke work in progress (not for review) #

Patch Set 19 : fix cubics #

Patch Set 20 : handle case where cubic stroke share start and end #

Patch Set 21 : allow error to be set by caller #

Patch Set 22 : fix pt to line if line points are degenerate #

Patch Set 23 : remove intersection limit experiment (unneeded) #

Patch Set 24 : remove changes to path validate #

Patch Set 25 : add time limit to new stroker test #

Patch Set 26 : remove test files #

Patch Set 27 : remove unnecessary changes, spaces #

Patch Set 28 : turn off quad stroke approximation #

Patch Set 29 : fix bench #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1740 lines, -37 lines) Patch
A bench/BezierBench.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 1 chunk +101 lines, -0 lines 0 comments Download
A gm/beziers.cpp View 1 2 3 4 1 chunk +87 lines, -0 lines 0 comments Download
A gm/smallarc.cpp View 1 2 3 4 5 6 7 8 9 10 1 chunk +54 lines, -0 lines 0 comments Download
M gyp/bench.gypi View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M gyp/gmslides.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 chunks +2 lines, -0 lines 0 comments Download
M gyp/tests.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 20 21 22 23 24 25 26 27 28 1 chunk +1 line, -0 lines 0 comments Download
M samplecode/SampleRotateCircles.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 7 chunks +162 lines, -37 lines 0 comments Download
M src/core/SkStroke.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 27 3 chunks +19 lines, -0 lines 0 comments Download
M src/core/SkStroke.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 17 chunks +858 lines, -0 lines 0 comments Download
M src/core/SkStrokeRec.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +3 lines, -0 lines 0 comments Download
A tests/StrokerTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 1 chunk +452 lines, -0 lines 0 comments Download

Messages

Total messages: 20 (7 generated)
caryclark
Florin, Stephen: I'm interested if this CL benefits SVG, and especially if there are thick-stroke ...
6 years, 2 months ago (2014-09-23 13:31:53 UTC) #2
reed1
lgtm
6 years, 2 months ago (2014-09-23 20:31:48 UTC) #3
f(malita)
On 2014/09/23 13:31:53, caryclark wrote: > Florin, Stephen: I'm interested if this CL benefits SVG, ...
6 years, 2 months ago (2014-09-23 21:25:54 UTC) #4
caryclark
I moved the 'tweak CL' into the main one. Now you can experiment with adjusting ...
6 years, 2 months ago (2014-09-24 12:35:27 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/558163005/180001
6 years, 2 months ago (2014-09-24 12:55:22 UTC) #7
commit-bot: I haz the power
Try jobs failed on following builders: Build-Ubuntu13.10-GCC4.8-Arm7-Debug-Android-Trybot on tryserver.skia (http://108.170.220.76:10117/builders/Build-Ubuntu13.10-GCC4.8-Arm7-Debug-Android-Trybot/builds/1560)
6 years, 2 months ago (2014-09-24 13:03:15 UTC) #9
brittanyrodriguez405_gmail.com
6 years, 2 months ago (2014-10-08 01:55:57 UTC) #11
caryclark
This is ready for final review and check-in. I'll create a separate CL to enable ...
6 years, 2 months ago (2014-10-08 16:07:26 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/558163005/540001
6 years, 2 months ago (2014-10-09 11:42:20 UTC) #14
commit-bot: I haz the power
Try jobs failed on following builders: Test-Ubuntu13.10-GCE-NoGPU-x86_64-Debug-Trybot on tryserver.skia (http://108.170.220.120:10117/builders/Test-Ubuntu13.10-GCE-NoGPU-x86_64-Debug-Trybot/builds/1081)
6 years, 2 months ago (2014-10-09 11:56:02 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/558163005/560001
6 years, 2 months ago (2014-10-09 12:25:29 UTC) #18
commit-bot: I haz the power
Committed patchset #29 (id:560001) as feff7d2d7719f52c7ea52db156003e609002bf04
6 years, 2 months ago (2014-10-09 12:36:08 UTC) #19
brittanyrodriguez405_gmail.com
6 years, 2 months ago (2014-10-10 06:33:04 UTC) #20
Message was sent while issue was closed.

          

Powered by Google App Engine
This is Rietveld 408576698