Re-enable ccpr clipping for small paths

For things like path rendering we can (and should) do better than an
atlas. But for use cases like "many small paths clipped by many small
paths," an atlas is probably still the best solution we have.

Change-Id: Iff5d250d0d6ccba9235f3fe652891554e3fdfc24
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/380856
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
diff --git a/src/gpu/GrClipStack.cpp b/src/gpu/GrClipStack.cpp
index ec85eaf..43f0bbf 100644
--- a/src/gpu/GrClipStack.cpp
+++ b/src/gpu/GrClipStack.cpp
@@ -1415,14 +1415,20 @@
                     if (fullyApplied) {
                         remainingAnalyticFPs--;
                     } else if (ccpr && e.aa() == GrAA::kYes) {
-                        // While technically the element is turned into a mask, each atlas entry
-                        // counts towards the FP complexity of the clip.
-                        // TODO - CCPR needs a stable ops task ID so we can't create FPs until we
-                        // know any other mask generation is finished. It also only works with AA
-                        // shapes, future atlas systems can improve on this.
-                        elementsForAtlas.push_back(&e);
-                        remainingAnalyticFPs--;
-                        fullyApplied = true;
+                        constexpr static int64_t kMaxClipPathArea =
+                                GrCoverageCountingPathRenderer::kMaxClipPathArea;
+                        SkIRect maskBounds;
+                        if (maskBounds.intersect(e.outerBounds(), draw.outerBounds()) &&
+                            maskBounds.height64() * maskBounds.width64() < kMaxClipPathArea) {
+                            // While technically the element is turned into a mask, each atlas entry
+                            // counts towards the FP complexity of the clip.
+                            // TODO - CCPR needs a stable ops task ID so we can't create FPs until
+                            // we know any other mask generation is finished. It also only works
+                            // with AA shapes, future atlas systems can improve on this.
+                            elementsForAtlas.push_back(&e);
+                            remainingAnalyticFPs--;
+                            fullyApplied = true;
+                        }
                     }
                 }