aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPathPriv.h
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2018-02-20 13:57:05 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-20 19:33:53 +0000
commit0c3137c4f45ffbf09a41526e5eb96e12cc6f35ae (patch)
tree31f5d59a6fac15770f513576e4c63d01891a54ec /src/core/SkPathPriv.h
parentc320b1576850745a1011ada0bcef3de5f9b9f649 (diff)
hide complex versions of isOval and isRRect
Bug: skia: Change-Id: I9fa899d409470f424fdfbef5b0c3bb528bcce40e Reviewed-on: https://skia-review.googlesource.com/108660 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/core/SkPathPriv.h')
-rw-r--r--src/core/SkPathPriv.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/core/SkPathPriv.h b/src/core/SkPathPriv.h
index ec748a9e36..49977b10fd 100644
--- a/src/core/SkPathPriv.h
+++ b/src/core/SkPathPriv.h
@@ -157,6 +157,60 @@ public:
return path.fPathRef->unique();
}
+ /** Returns true if constructed by addCircle(), addOval(); and in some cases,
+ addRoundRect(), addRRect(). SkPath constructed with conicTo() or rConicTo() will not
+ return true though SkPath draws oval.
+
+ rect receives bounds of oval.
+ dir receives SkPath::Direction of oval: kCW_Direction if clockwise, kCCW_Direction if
+ counterclockwise.
+ start receives start of oval: 0 for top, 1 for right, 2 for bottom, 3 for left.
+
+ rect, dir, and start are unmodified if oval is not found.
+
+ Triggers performance optimizations on some GPU surface implementations.
+
+ @param rect storage for bounding SkRect of oval; may be nullptr
+ @param dir storage for SkPath::Direction; may be nullptr
+ @param start storage for start of oval; may be nullptr
+ @return true if SkPath was constructed by method that reduces to oval
+ */
+ static bool IsOval(const SkPath& path, SkRect* rect, SkPath::Direction* dir, unsigned* start) {
+ bool isCCW = false;
+ bool result = path.fPathRef->isOval(rect, &isCCW, start);
+ if (dir && result) {
+ *dir = isCCW ? SkPath::kCCW_Direction : SkPath::kCW_Direction;
+ }
+ return result;
+ }
+
+ /** Returns true if constructed by addRoundRect(), addRRect(); and if construction
+ is not empty, not SkRect, and not oval. SkPath constructed with other calls
+ will not return true though SkPath draws SkRRect.
+
+ rrect receives bounds of SkRRect.
+ dir receives SkPath::Direction of oval: kCW_Direction if clockwise, kCCW_Direction if
+ counterclockwise.
+ start receives start of SkRRect: 0 for top, 1 for right, 2 for bottom, 3 for left.
+
+ rrect, dir, and start are unmodified if SkRRect is not found.
+
+ Triggers performance optimizations on some GPU surface implementations.
+
+ @param rrect storage for bounding SkRect of SkRRect; may be nullptr
+ @param dir storage for SkPath::Direction; may be nullptr
+ @param start storage for start of SkRRect; may be nullptr
+ @return true if SkPath contains only SkRRect
+ */
+ static bool IsRRect(const SkPath& path, SkRRect* rrect, SkPath::Direction* dir,
+ unsigned* start) {
+ bool isCCW = false;
+ bool result = path.fPathRef->isRRect(rrect, &isCCW, start);
+ if (dir && result) {
+ *dir = isCCW ? SkPath::kCCW_Direction : SkPath::kCW_Direction;
+ }
+ return result;
+ }
};
#endif