Go to file
caryclark feff7d2d77 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

Review URL: https://codereview.chromium.org/558163005
2014-10-09 05:36:04 -07:00
animations first cut at a checkbox 2009-10-21 19:41:10 +00:00
bench Draw more accurate thick-stroked Beziers (disabled) 2014-10-09 05:36:04 -07:00
debugger Update old tools to allow MultiPictureDraw rendering 2014-10-09 04:59:19 -07:00
dm Fix usage of SK_BUILD_* defines. 2014-10-06 10:46:51 -07:00
docs warn that docs/quickstart.md is out of sync with official docs 2014-04-21 19:18:46 +00:00
expectations Rebase Nexus 10 gm failure 2014-10-08 09:38:30 -07:00
experimental webtry: Simply move sys/ directory into setup/. 2014-10-08 20:05:13 -07:00
forth Sanitizing source files in Skia_Periodic_House_Keeping 2013-01-26 07:06:02 +00:00
gm Draw more accurate thick-stroked Beziers (disabled) 2014-10-09 05:36:04 -07:00
gyp Draw more accurate thick-stroked Beziers (disabled) 2014-10-09 05:36:04 -07:00
include Adding 3D lut color filter 2014-10-09 05:27:23 -07:00
platform_tools Make -d x86 have the default GPU cache size. 2014-09-09 12:07:05 -07:00
resources Add resources/mandrill_512_q075.jpg 2014-08-27 13:44:34 -04:00
samplecode Draw more accurate thick-stroked Beziers (disabled) 2014-10-09 05:36:04 -07:00
src Draw more accurate thick-stroked Beziers (disabled) 2014-10-09 05:36:04 -07:00
tests Draw more accurate thick-stroked Beziers (disabled) 2014-10-09 05:36:04 -07:00
third_party "NULL !=" = NULL 2014-09-05 13:34:00 -07:00
tools Make the Sk GL context class an abstract base class 2014-10-09 05:24:15 -07:00
trybots_to_run/chrome Deleting the hardcoded list of compile bots in trybots_to_run. 2013-04-09 11:59:42 +00:00
.gitignore Restart webtry to pick up changes. 2014-10-03 21:05:00 -07:00
AUTHORS Always disable the scissor test before BlitFrameBuffer 2014-09-16 06:24:58 -07:00
codereview.settings Add Project to skia 2014-06-20 09:39:15 -07:00
CONTRIBUTING Add CONTRIBUTING file 2014-01-13 15:06:26 +00:00
CQ_COMMITTERS Adding myself to comitters 2014-09-16 11:03:39 -07:00
DEPS rebaseline_server: allow users to generate SKP diff patches on a shared instance 2014-08-20 08:00:28 -07:00
Doxyfile delete no-longer-used update-doxygen.sh 2014-05-15 14:41:00 +00:00
gyp_skia allow caller to override the default output directory for gyp 2014-09-29 11:42:25 -07:00
gyp_skia.py Roll gyp deps from 1765 to 1796. 2013-11-21 18:11:14 +00:00
LICENSE Manually update copyright notices in files that defied the automated process 2011-07-28 14:24:55 +00:00
make.bat Enable compiling with automatically-downloaded VS toolchain on Windows bots 2014-06-16 10:02:42 -04:00
make.py Enable compiling with automatically-downloaded VS toolchain on Windows bots 2014-06-16 10:02:42 -04:00
Makefile Update LSAN suppressions. 2014-08-29 07:55:35 -07:00
OWNERS add root files from chrome 2013-08-13 19:11:15 +00:00
PRESUBMIT.py PRESUBMIT should only check owners for the top level include directory 2014-08-26 14:00:55 -07:00
README Point to skiadocs in our README. 2014-05-09 04:30:09 +00:00
README.chromium add root files from chrome 2013-08-13 19:11:15 +00:00
skia.gyp Remove the comments settings for vim tab width and expansion variables. 2013-12-02 22:23:03 +00:00
SKP_VERSION Update SKP version to 121 2014-10-08 21:24:38 -07:00
whitespace.txt Whitespace change to test CQ 2014-10-07 03:59:27 -07:00

Skia is a complete 2D graphic library for drawing Text, Geometries, and Images.

See full details, and build instructions, at https://sites.google.com/site/skiadocs/home