skia2/include
schenney@chromium.org 4da06ab335 Modifying SkPath to store all verbs provided by the user, and to give
correct results for all stroke and fill modes even on the various types
of degenerate paths.

The goals of this patch include:
1. Have Skia store all of the verbs implied by path construction methods, even
if those define degenerate paths. The SVG implementation in WebKit, which is
backed by Skia, needs to know about all elements of the path, even degenerate
ones, for the correct drawing of markers and line caps. For example, in SVG you
should be able to draw a scatter plot by specifying a marker for vertices and
then giving a sequence of moveTo commands. Skia will not store the moveTos,
requiring a different storage mechanism.

2. Assuming 1, maintain the current Skia behavior. That is, make Skia robust to
degenerate paths.

3. Fix an existing bug in Skia where a degenerate moveTo-lineTo pair spits out
warnings from rasterization and produces incorrect results in inverse-fill
renderings.

4. Adds extensive testing for degenerate paths and path rendering in general.

To meet these goals, the patch I am proposing will result in minor additional
storage for degenerate paths (a few bytes per degenerate path, only if the user
defines such paths). There is also some additional overhead in the iteration
code, with the path now cleaned to remove degenerate segments as part of the
iteration process. I suspect this will also fix issues with computing normal
vectors to degenerate segments. Benchmarking suggests that this change may
result in slightly (< 1%) slower path drawing due to the checks for
degeneracy. This overhead could be removed (in fact, a significant speedup
could occur) if the results of iterating to clean up the path were cached.
This would cost memory, of course, and quite a bit of it.

BUG=398
TEST=tests/PathTest.cpp
     gm/cubicpaths.cpp
     gm/degeneratesegments.cpp
     gm/movepaths.cpp
     gm/linepaths.cpp
     gm/quadpaths.cpp
Review URL: http://codereview.appspot.com/5482051

git-svn-id: http://skia.googlecode.com/svn/trunk@2901 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-12-20 15:14:18 +00:00
..
animator Automatic update of all copyright notices to reflect new license terms. 2011-07-28 14:26:00 +00:00
config remove obsolete SK_USE_RUNTIME_GLOBALS 2011-11-17 21:35:41 +00:00
core Modifying SkPath to store all verbs provided by the user, and to give 2011-12-20 15:14:18 +00:00
device/xps add SK_OVERRIDE, move subclass impls of virtuals into .cpp 2011-12-07 18:34:08 +00:00
effects add optional manual global initialization 2011-12-15 14:16:43 +00:00
gpu Access sampler matrices directly, cleanup GrSamplerState::reset()s 2011-12-12 18:45:07 +00:00
images add optional manual global initialization 2011-12-15 14:16:43 +00:00
pdf add SK_OVERRIDE, move subclass impls of virtuals into .cpp 2011-12-07 18:34:08 +00:00
pipe undef Status to undo the evil that XLib.h has done 2011-08-12 14:49:55 +00:00
ports Automatic update of all copyright notices to reflect new license terms. 2011-07-28 14:26:00 +00:00
svg Automatic update of all copyright notices to reflect new license terms. 2011-07-28 14:26:00 +00:00
text Automatic update of all copyright notices to reflect new license terms. 2011-07-28 14:26:00 +00:00
utils don't specify default parameter values when overriding a method 2011-12-07 14:46:39 +00:00
views fix mac warnings 2011-11-23 14:54:19 +00:00
xml Make SkMath.h less visible in public header files. 2011-09-27 17:38:17 +00:00