aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrShape.h
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2018-01-03 13:54:35 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-03 19:29:19 +0000
commitda6d0720300a29a4deb5dd4c433a92a3ec41286e (patch)
treec64a2d666876fe48034663f4fdbb18d2094938bb /src/gpu/GrShape.h
parentee9584eae40157c2a307a895a8183cc2ee37458e (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 'src/gpu/GrShape.h')
-rw-r--r--src/gpu/GrShape.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/gpu/GrShape.h b/src/gpu/GrShape.h
index 07cccb8a83..99579ba4c3 100644
--- a/src/gpu/GrShape.h
+++ b/src/gpu/GrShape.h
@@ -46,7 +46,7 @@ public:
explicit GrShape(const SkRect& rect) : GrShape(rect, GrStyle::SimpleFill()) {}
- GrShape(const SkPath& path, const GrStyle& style) : fStyle(style), fOriginalPath(path) {
+ GrShape(const SkPath& path, const GrStyle& style) : fStyle(style) {
this->initType(Type::kPath, &path);
this->attemptToSimplifyPath();
}
@@ -91,7 +91,7 @@ public:
this->attemptToSimplifyRRect();
}
- GrShape(const SkPath& path, const SkPaint& paint) : fStyle(paint), fOriginalPath(path) {
+ GrShape(const SkPath& path, const SkPaint& paint) : fStyle(paint) {
this->initType(Type::kPath, &path);
this->attemptToSimplifyPath();
}
@@ -375,13 +375,14 @@ public:
/**
* Helpers that are only exposed for unit tests, to determine if the shape is a path, and get
- * the generation ID of the *original* path.
+ * the generation ID of the *original* path. This is the path that will receive
+ * GenIDChangeListeners added to this shape.
*/
uint32_t testingOnly_getOriginalGenerationID() const;
bool testingOnly_isPath() const;
+ bool testingOnly_isNonVolatilePath() const;
private:
-
enum class Type {
kEmpty,
kInvertedEmpty,
@@ -440,6 +441,9 @@ private:
bool attemptToSimplifyStrokedLineToRRect();
+ /** Gets the path that gen id listeners should be added to. */
+ const SkPath* originalPathForListeners() const;
+
// Defaults to use when there is no distinction between even/odd and winding fills.
static constexpr SkPath::FillType kDefaultPathFillType = SkPath::kEvenOdd_FillType;
static constexpr SkPath::FillType kDefaultPathInverseFillType =
@@ -509,7 +513,7 @@ private:
} fLineData;
};
GrStyle fStyle;
- SkPath fOriginalPath;
+ SkTLazy<SkPath> fInheritedPathForListeners;
SkAutoSTArray<8, uint32_t> fInheritedKey;
};
#endif