Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Unified Diff: src/core/SkPath.cpp

Issue 22471002: Restore SkPath(const SkPath&) to copy the generation ID on Android. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix asserts Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkPath.h ('k') | tests/PathTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPath.cpp
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 875be9801e4d2910c2a757652abbb1c4a32395d3..f5b8bd5e79a907049b3e22065579645f36582e79 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -185,12 +185,12 @@ void SkPath::resetFields() {
}
SkPath::SkPath(const SkPath& that)
- : fPathRef(SkRef(that.fPathRef.get()))
+ : fPathRef(SkRef(that.fPathRef.get())) {
+ this->copyFields(that);
#ifdef SK_BUILD_FOR_ANDROID
- , fGenerationID(0)
+ fGenerationID = that.fGenerationID;
+ fSourcePath = NULL; // TODO(mtklein): follow up with Android: do we want to copy this too?
#endif
-{
- this->copyFields(that);
SkDEBUGCODE(that.validate();)
}
@@ -204,6 +204,10 @@ SkPath& SkPath::operator=(const SkPath& that) {
if (this != &that) {
fPathRef.reset(SkRef(that.fPathRef.get()));
this->copyFields(that);
+#ifdef SK_BUILD_FOR_ANDROID
+ GEN_ID_INC; // Similar to swap, we can't just copy this or it could go back in time.
+ fSourcePath = NULL; // TODO(mtklein): follow up with Android: do we want to copy this too?
+#endif
}
SkDEBUGCODE(this->validate();)
return *this;
@@ -220,10 +224,6 @@ void SkPath::copyFields(const SkPath& that) {
fDirection = that.fDirection;
fIsFinite = that.fIsFinite;
fIsOval = that.fIsOval;
-#ifdef SK_BUILD_FOR_ANDROID
- GEN_ID_INC;
- fSourcePath = NULL;
-#endif
}
SK_API bool operator==(const SkPath& a, const SkPath& b) {
@@ -253,8 +253,13 @@ void SkPath::swap(SkPath& that) {
SkTSwap<uint8_t>(fDirection, that.fDirection);
SkTSwap<SkBool8>(fIsFinite, that.fIsFinite);
SkTSwap<SkBool8>(fIsOval, that.fIsOval);
+#ifdef SK_BUILD_FOR_ANDROID
+ // It doesn't really make sense to swap the generation IDs here, because they might go
+ // backwards. To be safe we increment both to mark them both as changed.
GEN_ID_INC;
GEN_ID_PTR_INC(&that);
+ SkTSwap<const SkPath*>(fSourcePath, that.fSourcePath);
+#endif
}
}
« no previous file with comments | « include/core/SkPath.h ('k') | tests/PathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698