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

Unified Diff: src/core/SkPathRef.cpp

Issue 49693002: Use SkPathRef gen id for SkPath::getGenerationID (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: upload again, rietveld diff failed. Created 7 years, 2 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 | « src/core/SkPath.cpp ('k') | tests/PathTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPathRef.cpp
diff --git a/src/core/SkPathRef.cpp b/src/core/SkPathRef.cpp
index f635c2a3e5806abda5501e9da850518604b8b4b2..f811b245ec425d1f14594f28773e745c894c8c48 100644
--- a/src/core/SkPathRef.cpp
+++ b/src/core/SkPathRef.cpp
@@ -289,8 +289,9 @@ SkPoint* SkPathRef::growForVerb(int /* SkPath::Verb*/ verb) {
return ret;
}
-int32_t SkPathRef::genID() const {
+uint32_t SkPathRef::genID() const {
SkASSERT(!fEditorsAttached);
+ static const uint32_t kMask = (static_cast<int64_t>(1) << SkPath::kPathRefGenIDBitCnt) - 1;
if (!fGenerationID) {
if (0 == fPointCnt && 0 == fVerbCnt) {
fGenerationID = kEmptyGenID;
@@ -299,7 +300,7 @@ int32_t SkPathRef::genID() const {
// do a loop in case our global wraps around, as we never want to return a 0 or the
// empty ID
do {
- fGenerationID = sk_atomic_inc(&gPathRefGenerationID) + 1;
+ fGenerationID = (sk_atomic_inc(&gPathRefGenerationID) + 1) & kMask;
} while (fGenerationID <= kEmptyGenID);
}
}
« no previous file with comments | « src/core/SkPath.cpp ('k') | tests/PathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698