Implement caching of filled paths in the tessellated path renderer.
authorsenorblanco <senorblanco@chromium.org>
Tue, 4 Aug 2015 17:01:58 +0000 (10:01 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 4 Aug 2015 17:01:58 +0000 (10:01 -0700)
commit84cd621670a357484e1674e06d3d8d6f929a4ab2
treea4ab6bce0dd381065a2e2b33df7ccf4b20863c27
parent846b022f6b469cfde285372f26e0d5c593d122ac
Implement caching of filled paths in the tessellated path renderer.

Paths are cached as tessellated triangle meshes in vertex buffers on the GPU. Stroked paths are not (yet) cached.

Paths containing no curved segments (linear paths) are reused at all scales. Paths containing curved segments are reused within a scale tolerance threshold.

In order to invalidate the cache when an SkPath is changed or deleted,
this required implementing genID change notification in SkPath. This is
modelled almost exactly on SkPixelRef::GenIDChangeListener.
However, It does not currently implement the check for unique genIDs,
so notifiers will fire when the first instance of an SkPathRef
using a given genID is destroyed.

Another caveat is that you cannot successfully add a change notifier
to an empty path, since it uses the "canonical" empty path which is
never modified or destroyed. For this reason, we prevent adding
listeners to it.

BUG=skia:4121,skia:4122, 497403
DOCS_PREVIEW= https://skia.org/?cl=1114353004

Committed: https://skia.googlesource.com/skia/+/468dfa72eb6694145487be17876804dfca3b7adb

Review URL: https://codereview.chromium.org/1114353004
include/core/SkPathRef.h
include/gpu/GrResourceKey.h
src/core/SkPathPriv.h
src/core/SkPathRef.cpp
src/gpu/GrTessellatingPathRenderer.cpp
tests/PathTest.cpp
tests/ResourceCacheTest.cpp