aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
authorGravatar Adrienne Walker <enne@chromium.org>2017-08-10 12:16:37 -0700
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-10 20:22:35 +0000
commitad8da8ea990d22fa717ec1ae7c3ad628d74682b8 (patch)
tree0381a40ea1c53889b52122abe3effb213ac7b052 /include/core
parent6a653a5f7dd08ceb588d82f267e84ec6523194c2 (diff)
Expose SkPath validation as boolean
As a part of serializing SkPaths, I want to be able to know (without asserting) whether or not a path is valid so that I can discard potentially malicious deserialized paths. Currently, SkPath(Ref) both just have asserting validation functions which can't be used externally. This patch adds accessors that don't assert. Bug: chromium:752755 skia:6955 Change-Id: I4d0ceb31ec660b87e3fda438392ad2b60a27a0da Reviewed-on: https://skia-review.googlesource.com/31720 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Mike Reed <reed@google.com>
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkPath.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/core/SkPath.h b/include/core/SkPath.h
index d0841fd250..0a70f0e9ad 100644
--- a/include/core/SkPath.h
+++ b/include/core/SkPath.h
@@ -1119,7 +1119,9 @@ public:
static const int kPathRefGenIDBitCnt = 32;
#endif
- SkDEBUGCODE(void validate() const;)
+ bool isValid() const;
+ bool pathRefIsValid() const { return fPathRef->isValid(); }
+ SkDEBUGCODE(void validate() const { SkASSERT(this->isValid()); } )
SkDEBUGCODE(void experimentalValidateRef() const { fPathRef->validate(); } )
private: