aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/GrShapeTest.cpp
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-09-25 16:49:55 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-26 12:52:36 +0000
commitf6f7cf60985d8e109cc136f25e2a3c3383ca05ea (patch)
tree51fb0a5c7dc44a75b0f89d1436a01b01358e5b88 /tests/GrShapeTest.cpp
parent6bba6de94461cdb97a451bc7f88eec3b1ab71079 (diff)
Invalidate path VBs when paths are destroyed
For this to work, we need access to the "original" path, before any style was applied. To that end, add an original path to GrShape (and unit tests of that functionality). Then add a version of addGenIDChangeListener to GrShape, that propagates to the original path, and use that in tessellating path renderer. Includes unit tests of caching behavior in the PR, all of which failed without this change. Bug: skia: Change-Id: I98bb505f521e8ff07184f5c3fbd3c5fd1a22d3d5 Reviewed-on: https://skia-review.googlesource.com/50300 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'tests/GrShapeTest.cpp')
-rw-r--r--tests/GrShapeTest.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/GrShapeTest.cpp b/tests/GrShapeTest.cpp
index 087ac525c8..2b2a169477 100644
--- a/tests/GrShapeTest.cpp
+++ b/tests/GrShapeTest.cpp
@@ -17,6 +17,10 @@
#include "SkSurface.h"
#include "SkClipOpPriv.h"
+uint32_t GrShape::testingOnly_getOriginalGenerationID() const {
+ return fOriginalPath.getGenerationID();
+}
+
using Key = SkTArray<uint32_t>;
static bool make_key(Key* key, const GrShape& shape) {
@@ -493,6 +497,13 @@ private:
make_key(&fAppliedPEThenStrokeKey, fAppliedPEThenStroke);
make_key(&fAppliedFullKey, fAppliedFull);
+ // All shapes should report the same "original" path, so that path renderers can get to it
+ // if necessary.
+ uint32_t baseGenID = fBase.testingOnly_getOriginalGenerationID();
+ REPORTER_ASSERT(r, baseGenID == fAppliedPE.testingOnly_getOriginalGenerationID());
+ REPORTER_ASSERT(r, baseGenID == fAppliedPEThenStroke.testingOnly_getOriginalGenerationID());
+ REPORTER_ASSERT(r, baseGenID == fAppliedFull.testingOnly_getOriginalGenerationID());
+
// Applying the path effect and then the stroke should always be the same as applying
// both in one go.
REPORTER_ASSERT(r, fAppliedPEThenStrokeKey == fAppliedFullKey);