diff options
author | 2017-09-14 10:31:36 -0400 | |
---|---|---|
committer | 2017-09-14 17:32:41 +0000 | |
commit | b20154499a7c06d88f8d8b67fa5a19a130095640 (patch) | |
tree | 364145e656a7d21be74af841099db6430c650212 | |
parent | 7265ea32e5b543fa1cf0f12f469ac51f6a22f55b (diff) |
make kPathRefGenIDBitCnt private
kPathRefGenIDBitCnt is used only by SkPath.cpp and SkPathRef.cpp.
Curiously, there's no existing private declarations shared by
SkPath and SkPathRef, so I added kPathRefGenIDBitCnt to
SkPathPriv.h as the go-between. If there's an existing convention
I overlooked, please let me know.
R=reed@google.com,djsollen@google.com
Bug: skia: 6898
Change-Id: I929d780c3b4a10e5cf78e7176a7516abf912508e
Reviewed-on: https://skia-review.googlesource.com/46560
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Cary Clark <caryclark@skia.org>
-rw-r--r-- | include/core/SkPath.h | 8 | ||||
-rw-r--r-- | src/core/SkPath.cpp | 4 | ||||
-rw-r--r-- | src/core/SkPathPriv.h | 6 | ||||
-rw-r--r-- | src/core/SkPathRef.cpp | 3 |
4 files changed, 11 insertions, 10 deletions
diff --git a/include/core/SkPath.h b/include/core/SkPath.h index e38b464d85..dd77ef425f 100644 --- a/include/core/SkPath.h +++ b/include/core/SkPath.h @@ -1611,19 +1611,13 @@ enum Direction { */ uint32_t getGenerationID() const; -#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK - static const int kPathRefGenIDBitCnt = 30; // leave room for the fill type (skbug.com/1762) -#else - static const int kPathRefGenIDBitCnt = 32; -#endif - +#ifdef SK_SUPPORT_DIRECT_PATHREF_VALIDATION /** Returns if SkPath data is consistent. Corrupt SkPath data is detected if internal values are out of range or internal storage does not match array dimensions. @return true if SkPath data is consistent */ -#ifdef SK_SUPPORT_DIRECT_PATHREF_VALIDATION bool isValid() const { return this->isValidImpl() && fPathRef->isValid(); } #else bool isValid() const { return this->isValidImpl(); } diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp index 5dcca6fff1..99d7e1a66e 100644 --- a/src/core/SkPath.cpp +++ b/src/core/SkPath.cpp @@ -341,8 +341,8 @@ bool SkPath::conservativelyContainsRect(const SkRect& rect) const { uint32_t SkPath::getGenerationID() const { uint32_t genID = fPathRef->genID(); #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK - SkASSERT((unsigned)fFillType < (1 << (32 - kPathRefGenIDBitCnt))); - genID |= static_cast<uint32_t>(fFillType) << kPathRefGenIDBitCnt; + SkASSERT((unsigned)fFillType < (1 << (32 - SkPathPriv::kPathRefGenIDBitCnt))); + genID |= static_cast<uint32_t>(fFillType) << SkPathPriv::kPathRefGenIDBitCnt; #endif return genID; } diff --git a/src/core/SkPathPriv.h b/src/core/SkPathPriv.h index febc4e35e5..89c1e6572f 100644 --- a/src/core/SkPathPriv.h +++ b/src/core/SkPathPriv.h @@ -12,6 +12,12 @@ class SkPathPriv { public: +#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK + static const int kPathRefGenIDBitCnt = 30; // leave room for the fill type (skbug.com/1762) +#else + static const int kPathRefGenIDBitCnt = 32; +#endif + enum FirstDirection { kCW_FirstDirection, // == SkPath::kCW_Direction kCCW_FirstDirection, // == SkPath::kCCW_Direction diff --git a/src/core/SkPathRef.cpp b/src/core/SkPathRef.cpp index 46f26606ee..4f550afa5a 100644 --- a/src/core/SkPathRef.cpp +++ b/src/core/SkPathRef.cpp @@ -10,6 +10,7 @@ #include "SkOnce.h" #include "SkPath.h" #include "SkPathRef.h" +#include "SkPathPriv.h" #include <limits> ////////////////////////////////////////////////////////////////////////////// @@ -592,7 +593,7 @@ SkPoint* SkPathRef::growForVerb(int /* SkPath::Verb*/ verb, SkScalar weight) { uint32_t SkPathRef::genID() const { SkASSERT(!fEditorsAttached); - static const uint32_t kMask = (static_cast<int64_t>(1) << SkPath::kPathRefGenIDBitCnt) - 1; + static const uint32_t kMask = (static_cast<int64_t>(1) << SkPathPriv::kPathRefGenIDBitCnt) - 1; if (!fGenerationID) { if (0 == fPointCnt && 0 == fVerbCnt) { fGenerationID = kEmptyGenID; |