diff options
author | Cary Clark <caryclark@skia.org> | 2017-08-25 15:13:38 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-08-29 18:37:11 +0000 |
commit | 0461e9fa44e0cb6035f14be00430f7294da68993 (patch) | |
tree | 6635af7e7537281c3b471a02c55a5149d475a4cd /include/core/SkPath.h | |
parent | 4eaadf1c548c421b985af35f5da286db92955f63 (diff) |
simplify path validate
Reduce path validation interfaces,
deferring the harder work of rewriting
the callers until later.
R=reed@google.com,enne@chromium.org
Change-Id: Iea56f1cd1be93bb1d96b50836a9bd3cd4872ad23
Reviewed-on: https://skia-review.googlesource.com/37541
Commit-Queue: Cary Clark <caryclark@google.com>
Reviewed-by: Adrienne Walker <enne@chromium.org>
Diffstat (limited to 'include/core/SkPath.h')
-rw-r--r-- | include/core/SkPath.h | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/include/core/SkPath.h b/include/core/SkPath.h index f0d6f3b2ae..c3031660a6 100644 --- a/include/core/SkPath.h +++ b/include/core/SkPath.h @@ -1119,10 +1119,18 @@ public: static const int kPathRefGenIDBitCnt = 32; #endif - bool isValid() const; + /** 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(); } bool pathRefIsValid() const { return fPathRef->isValid(); } - SkDEBUGCODE(void validate() const { SkASSERT(this->isValid()); } ) - SkDEBUGCODE(void experimentalValidateRef() const { fPathRef->validate(); } ) +#endif private: enum SerializationOffsets { @@ -1183,6 +1191,13 @@ private: Convexity internalGetConvexity() const; + /** Asserts if SkPath data is inconsistent. + Debugging check intended for internal use only. + */ + SkDEBUGCODE(void validate() const { SkASSERT(this->isValidImpl()); } ) + bool isValidImpl() const; + SkDEBUGCODE(void validateRef() const { fPathRef->validate(); } ) + bool isRectContour(bool allowPartial, int* currVerb, const SkPoint** pts, bool* isClosed, Direction* direction) const; @@ -1215,6 +1230,7 @@ private: friend class SkBench_AddPathTest; // perf test reversePathTo friend class PathTest_Private; // unit test reversePathTo friend class ForceIsRRect_Private; // unit test isRRect + friend class FuzzPath; // for legacy access to validateRef }; #endif |