Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Unified Diff: include/core/SkRRect.h

Issue 194703011: Add effect-based clip for nine-patch SkRRects. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: include/core/SkRRect.h
diff --git a/include/core/SkRRect.h b/include/core/SkRRect.h
index 9878b54fdc0019be255f3c18551b748cd9dce8aa..c09d2d46fe85aed3ca925d2419fcb98838138225 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(); }

Powered by Google App Engine
This is Rietveld 408576698