diff options
author | Brian Salomon <bsalomon@google.com> | 2018-01-03 13:54:35 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-01-03 19:29:19 +0000 |
commit | da6d0720300a29a4deb5dd4c433a92a3ec41286e (patch) | |
tree | c64a2d666876fe48034663f4fdbb18d2094938bb /tests/GrShapeTest.cpp | |
parent | ee9584eae40157c2a307a895a8183cc2ee37458e (diff) |
Make GrShape lazily initialize an original path for gen id change listeners
Change-Id: I3a1cb400190cf18241436b7e655a4a267bb2e22d
Reviewed-on: https://skia-review.googlesource.com/90482
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Diffstat (limited to 'tests/GrShapeTest.cpp')
-rw-r--r-- | tests/GrShapeTest.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/tests/GrShapeTest.cpp b/tests/GrShapeTest.cpp index 2b80a84d63..261a7d2500 100644 --- a/tests/GrShapeTest.cpp +++ b/tests/GrShapeTest.cpp @@ -18,13 +18,20 @@ #include "SkClipOpPriv.h" uint32_t GrShape::testingOnly_getOriginalGenerationID() const { - return fOriginalPath.getGenerationID(); + if (const auto* lp = this->originalPathForListeners()) { + return lp->getGenerationID(); + } + return SkPath().getGenerationID(); } bool GrShape::testingOnly_isPath() const { return Type::kPath == fType; } +bool GrShape::testingOnly_isNonVolatilePath() const { + return Type::kPath == fType && !fPathData.fPath.isVolatile(); +} + using Key = SkTArray<uint32_t>; static bool make_key(Key* key, const GrShape& shape) { @@ -219,7 +226,7 @@ static void check_equivalence(skiatest::Reporter* r, const GrShape& a, const GrS static void check_original_path_ids(skiatest::Reporter* r, const GrShape& base, const GrShape& pe, const GrShape& peStroke, const GrShape& full) { - bool baseIsPath = base.testingOnly_isPath(); + bool baseIsNonVolatilePath = base.testingOnly_isNonVolatilePath(); bool peIsPath = pe.testingOnly_isPath(); bool peStrokeIsPath = peStroke.testingOnly_isPath(); bool fullIsPath = full.testingOnly_isPath(); @@ -235,8 +242,9 @@ static void check_original_path_ids(skiatest::Reporter* r, const GrShape& base, uint32_t emptyID = SkPath().getGenerationID(); // If we started with a real path, then our genID should match that path's gen ID (and not be - // empty). If we started with a simple shape, our original path should have been reset. - REPORTER_ASSERT(r, baseIsPath == (baseID != emptyID)); + // empty). If we started with a simple shape or a volatile path, our original path should have + // been reset. + REPORTER_ASSERT(r, baseIsNonVolatilePath == (baseID != emptyID)); // For the derived shapes, if they're simple types, their original paths should have been reset REPORTER_ASSERT(r, peIsPath || (peID == emptyID)); @@ -250,7 +258,7 @@ static void check_original_path_ids(skiatest::Reporter* r, const GrShape& base, // From here on, we know that the path effect produced a shape that was a "real" path - if (baseIsPath) { + if (baseIsNonVolatilePath) { REPORTER_ASSERT(r, baseID == peID); } @@ -259,7 +267,7 @@ static void check_original_path_ids(skiatest::Reporter* r, const GrShape& base, REPORTER_ASSERT(r, peStrokeID == fullID); } - if (baseIsPath && peStrokeIsPath) { + if (baseIsNonVolatilePath && peStrokeIsPath) { REPORTER_ASSERT(r, baseID == peStrokeID); REPORTER_ASSERT(r, baseID == fullID); } |