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>
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index ab8bf2e..95fa37f 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -632,6 +632,14 @@
     return false;
 }
 
+bool SkPath::isOval(SkRect* bounds) const {
+    return SkPathPriv::IsOval(*this, bounds, nullptr, nullptr);
+}
+
+bool SkPath::isRRect(SkRRect* rrect) const {
+    return SkPathPriv::IsRRect(*this, rrect, nullptr, nullptr);
+}
+
 int SkPath::countPoints() const {
     return fPathRef->countPoints();
 }
diff --git a/src/core/SkPathPriv.h b/src/core/SkPathPriv.h
index ec748a9..49977b1 100644
--- a/src/core/SkPathPriv.h
+++ b/src/core/SkPathPriv.h
@@ -157,6 +157,60 @@
         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
diff --git a/src/gpu/GrShape.cpp b/src/gpu/GrShape.cpp
index 8c0a0ae..2d2bccb 100644
--- a/src/gpu/GrShape.cpp
+++ b/src/gpu/GrShape.cpp
@@ -483,14 +483,14 @@
         fLineData.fPts[0] = pts[0];
         fLineData.fPts[1] = pts[1];
         fLineData.fInverted = inverted;
-    } else if (this->path().isRRect(&rrect, &rrectDir, &rrectStart)) {
+    } else if (SkPathPriv::IsRRect(this->path(), &rrect, &rrectDir, &rrectStart)) {
         this->changeType(Type::kRRect);
         fRRectData.fRRect = rrect;
         fRRectData.fDir = rrectDir;
         fRRectData.fStart = rrectStart;
         fRRectData.fInverted = inverted;
         SkASSERT(!fRRectData.fRRect.isEmpty());
-    } else if (this->path().isOval(&rect, &rrectDir, &rrectStart)) {
+    } else if (SkPathPriv::IsOval(this->path(), &rect, &rrectDir, &rrectStart)) {
         this->changeType(Type::kRRect);
         fRRectData.fRRect.setOval(rect);
         fRRectData.fDir = rrectDir;