Add new "sourcePath" API to SkPath
This is required to optimize texture generation in display lists.
Change-Id: I7291e3af85771bfa74190b718d45e61555c7087d
diff --git a/include/core/SkPath.h b/include/core/SkPath.h
index 859486c..536e887 100644
--- a/include/core/SkPath.h
+++ b/include/core/SkPath.h
@@ -732,6 +732,8 @@
#ifdef SK_BUILD_FOR_ANDROID
uint32_t getGenerationID() const;
+ const SkPath* getSourcePath() const;
+ void setSourcePath(const SkPath* path);
#endif
SkDEBUGCODE(void validate() const;)
@@ -746,6 +748,7 @@
mutable uint8_t fConvexity;
#ifdef SK_BUILD_FOR_ANDROID
uint32_t fGenerationID;
+ const SkPath* fSourcePath;
#endif
// called, if dirty, by getBounds()
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index e6c1c25..9f3ef50 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -108,6 +108,7 @@
fSegmentMask = 0;
#ifdef SK_BUILD_FOR_ANDROID
fGenerationID = 0;
+ fSourcePath = NULL;
#endif
}
@@ -117,6 +118,7 @@
#ifdef SK_BUILD_FOR_ANDROID
// the assignment operator above increments the ID so correct for that here
fGenerationID = src.fGenerationID;
+ fSourcePath = NULL;
#endif
}
@@ -173,6 +175,14 @@
uint32_t SkPath::getGenerationID() const {
return fGenerationID;
}
+
+const SkPath* SkPath::getSourcePath() const {
+ return fSourcePath;
+}
+
+void SkPath::setSourcePath(const SkPath* path) {
+ fSourcePath = path;
+}
#endif
void SkPath::reset() {