Don't fail clip atlas instantiation when the access is out of bounds

This means the draw is entirely clipped out, so we just don't even
create the FP to begin with.

Change-Id: I6d8a2a2e18be07c8a1408437c4bcc3d9349b77a2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/387057
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp b/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp
index f44502f..ec08d69 100644
--- a/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp
+++ b/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp
@@ -51,7 +51,7 @@
     return it->second.get();
 }
 
-std::unique_ptr<GrFragmentProcessor> GrCoverageCountingPathRenderer::makeClipProcessor(
+GrFPResult GrCoverageCountingPathRenderer::makeClipProcessor(
         std::unique_ptr<GrFragmentProcessor> inputFP, uint32_t opsTaskID,
         const SkPath& deviceSpacePath, const SkIRect& accessRect, const GrCaps& caps) {
 #ifdef SK_DEBUG
@@ -64,6 +64,12 @@
     }
 #endif
 
+    if (deviceSpacePath.isEmpty() ||
+        !SkIRect::Intersects(accessRect, deviceSpacePath.getBounds().roundOut())) {
+        // "Intersect" draws that don't intersect the clip can be dropped.
+        return deviceSpacePath.isInverseFillType() ? GrFPSuccess(nullptr) : GrFPFailure(nullptr);
+    }
+
     uint32_t key = deviceSpacePath.getGenerationID();
     key = (key << 1) | (uint32_t)GrFillRuleForSkPath(deviceSpacePath);
     GrCCClipPath& clipPath =
@@ -77,8 +83,8 @@
 
     auto mustCheckBounds = GrCCClipProcessor::MustCheckBounds(
             !clipPath.pathDevIBounds().contains(accessRect));
-    return std::make_unique<GrCCClipProcessor>(std::move(inputFP), caps, &clipPath,
-                                               mustCheckBounds);
+    return GrFPSuccess(std::make_unique<GrCCClipProcessor>(std::move(inputFP), caps, &clipPath,
+                                                           mustCheckBounds));
 }
 
 void GrCoverageCountingPathRenderer::preFlush(