aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/StrokerTest.cpp
Commit message (Collapse)AuthorAge
* rename command line flag to avoid conflict, use very verboseGravatar caryclark2014-10-09
| | | | | | | | TBR= NOTRY=true NOTREECHECKS=true Review URL: https://codereview.chromium.org/645573003
* try again to fix ios buildGravatar caryclark2014-10-09
| | | | | | | | TBR= NOTRY=true NOTREECHECKS=true Review URL: https://codereview.chromium.org/638403002
* fix ios buildGravatar caryclark2014-10-09
| | | | | | | | NOTREECHECKS=true NOTRY=true TBR= Review URL: https://codereview.chromium.org/641063002
* Draw more accurate thick-stroked Beziers (disabled)Gravatar caryclark2014-10-09
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 Review URL: https://codereview.chromium.org/558163005