aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkRRect.h
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-13 18:01:05 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-13 18:01:05 +0000
commitfa5edbe5750632b4590ed951c594dd2766ccc4cf (patch)
treeea35a8f03a39defbaf637828d87bd52cfbc4950f /include/core/SkRRect.h
parent9c28fa5579734129f1bad026b8b6aea3bf76da5f (diff)
Add effect-based clip for nine-patch SkRRects.
BUG=skia:2181 R=jvanverth@google.com, robertphillips@google.com, rmistry@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/194703011 git-svn-id: http://skia.googlecode.com/svn/trunk@13794 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core/SkRRect.h')
-rw-r--r--include/core/SkRRect.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/core/SkRRect.h b/include/core/SkRRect.h
index 9878b54fdc..c09d2d46fe 100644
--- a/include/core/SkRRect.h
+++ b/include/core/SkRRect.h
@@ -103,6 +103,17 @@ public:
bool allCornersCircular() const;
+ /**
+ * Are both x-radii the same on the two left corners, and similar for the top, right, and
+ * bottom. When this is the case the four ellipse centers form a rectangle.
+ */
+ bool isNinePatch() const {
+ return fRadii[kUpperLeft_Corner].fX == fRadii[kLowerLeft_Corner].fX &&
+ fRadii[kUpperRight_Corner].fX == fRadii[kLowerRight_Corner].fX &&
+ fRadii[kUpperLeft_Corner].fY == fRadii[kUpperRight_Corner].fY &&
+ fRadii[kLowerLeft_Corner].fY == fRadii[kLowerRight_Corner].fY;
+ }
+
SkScalar width() const { return fRect.width(); }
SkScalar height() const { return fRect.height(); }