Accept near-simple, near-circular rrects for shadow fast path.

SkRRectPriv::IsSimpleCircular does a tolerance-based check for the
rrect radii but not for determining if the rrect is simple. This adds
IsNearlySimpleCircular as a looser check, since we don't care in this
case that the rrect is perfectly simple.

Bug: skia:11717
Change-Id: Ibbd53ff8c120287339fa29f87f064e6fb633ee7c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/382703
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
diff --git a/src/gpu/GrSurfaceDrawContext.cpp b/src/gpu/GrSurfaceDrawContext.cpp
index 57a252b..7556d15 100644
--- a/src/gpu/GrSurfaceDrawContext.cpp
+++ b/src/gpu/GrSurfaceDrawContext.cpp
@@ -977,9 +977,9 @@
 
     SkRRect rrect;
     SkRect rect;
-    // we can only handle rects, circles, and rrects with circular corners
-    bool isRRect = path.isRRect(&rrect) && SkRRectPriv::IsSimpleCircular(rrect) &&
-        rrect.radii(SkRRect::kUpperLeft_Corner).fX > SK_ScalarNearlyZero;
+    // we can only handle rects, circles, and simple rrects with circular corners
+    bool isRRect = path.isRRect(&rrect) && SkRRectPriv::IsNearlySimpleCircular(rrect) &&
+                   rrect.getSimpleRadii().fX > SK_ScalarNearlyZero;
     if (!isRRect &&
         path.isOval(&rect) && SkScalarNearlyEqual(rect.width(), rect.height()) &&
         rect.width() > SK_ScalarNearlyZero) {
@@ -1089,7 +1089,7 @@
         SkMatrix shadowTransform;
         shadowTransform.setScaleTranslate(spotScale, spotScale, spotOffset.fX, spotOffset.fY);
         rrect.transform(shadowTransform, &spotShadowRRect);
-        SkScalar spotRadius = SkRRectPriv::GetSimpleRadii(spotShadowRRect).fX;
+        SkScalar spotRadius = spotShadowRRect.getSimpleRadii().fX;
 
         // Compute the insetWidth
         SkScalar blurOutset = srcSpaceSpotBlur;
@@ -1132,7 +1132,7 @@
                                                          spotShadowRRect.rect().fBottom -
                                                          rrect.rect().fBottom - dr);
                 maxOffset = SkScalarSqrt(std::max(SkPointPriv::LengthSqd(upperLeftOffset),
-                                                SkPointPriv::LengthSqd(lowerRightOffset))) + dr;
+                                                  SkPointPriv::LengthSqd(lowerRightOffset))) + dr;
             }
             insetWidth += std::max(blurOutset, maxOffset);
         }