aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-25 16:54:31 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-25 16:54:31 +0000
commitc2abd54edadf94bb86e1635a3515089e4a6a8eee (patch)
tree731cd65b582e38d39db164570a4d627c18a05cfd /src/core
parenteb9a46cbbb475e862a084aa2224ec18d4ac5e95b (diff)
add alternative to isRect named asRect
This defines yunchao's proposed interface in terms of an existing implementation. BUG=skia: R=reed@google.com, yunchao.he@intel.com Author: caryclark@google.com Review URL: https://codereview.chromium.org/140953003 git-svn-id: http://skia.googlecode.com/svn/trunk@13183 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkPath.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 8602f4b0d4..04c807b644 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -504,6 +504,14 @@ bool SkPath::isRectContour(bool allowPartial, int* currVerb, const SkPoint** pts
return result;
}
+SkPath::PathAsRect SkPath::asRect(Direction* direction) const {
+ SK_COMPILE_ASSERT(0 == kNone_PathAsRect, path_as_rect_mismatch);
+ SK_COMPILE_ASSERT(1 == kStroke_PathAsRect, path_as_rect_mismatch);
+ SK_COMPILE_ASSERT(2 == kFill_PathAsRect, path_as_rect_mismatch);
+ bool isClosed = false;
+ return (PathAsRect) (isRect(&isClosed, direction) + isClosed);
+}
+
bool SkPath::isRect(SkRect* rect) const {
SkDEBUGCODE(this->validate();)
int currVerb = 0;