[graphite] Remove usage of GrClip in should_tile_image_id

should_tile_image_id is going to become part of the large image API so can't rely on Ganesh-specific objects.

Bug: b/267656937
Change-Id: I5e817dd69a6c138a9707d0fe54c1e344a55a6a6c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/702377
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/ganesh/Device_drawTexture.cpp b/src/gpu/ganesh/Device_drawTexture.cpp
index 33f672a..34aadaf 100644
--- a/src/gpu/ganesh/Device_drawTexture.cpp
+++ b/src/gpu/ganesh/Device_drawTexture.cpp
@@ -139,14 +139,11 @@
 
 // Given a bitmap, an optional src rect, and a context with a clip and matrix determine what
 // pixels from the bitmap are necessary.
-SkIRect determine_clipped_src_rect(int width, int height,
-                                   const GrClip* clip,
+SkIRect determine_clipped_src_rect(SkIRect clippedSrcIRect,
                                    const SkMatrix& viewMatrix,
                                    const SkMatrix& srcToDstRect,
                                    const SkISize& imageDimensions,
                                    const SkRect* srcRectPtr) {
-    SkIRect clippedSrcIRect = clip ? clip->getConservativeBounds()
-                                   : SkIRect::MakeWH(width, height);
     SkMatrix inv = SkMatrix::Concat(viewMatrix, srcToDstRect);
     if (!inv.invert(&inv)) {
         return SkIRect::MakeEmpty();
@@ -169,8 +166,7 @@
 
 // tileSize and clippedSubset are valid if true is returned
 bool should_tile_image_id(GrRecordingContext* context,
-                          SkISize rtSize,
-                          const GrClip* clip,
+                          SkIRect conservativeClipBounds,
                           uint32_t imageID,
                           const SkISize& imageSize,
                           const SkMatrix& ctm,
@@ -181,7 +177,7 @@
                           SkIRect* clippedSubset) {
     // if it's larger than the max tile size, then we have no choice but tiling.
     if (imageSize.width() > maxTileSize || imageSize.height() > maxTileSize) {
-        *clippedSubset = determine_clipped_src_rect(rtSize.width(), rtSize.height(), clip, ctm,
+        *clippedSubset = determine_clipped_src_rect(conservativeClipBounds, ctm,
                                                     srcToDst, imageSize, src);
         *tileSize = determine_tile_size(*clippedSubset, maxTileSize);
         return true;
@@ -215,7 +211,7 @@
 
     // Figure out how much of the src we will need based on the src rect and clipping. Reject if
     // tiling memory savings would be < 50%.
-    *clippedSubset = determine_clipped_src_rect(rtSize.width(), rtSize.height(), clip, ctm,
+    *clippedSubset = determine_clipped_src_rect(conservativeClipBounds, ctm,
                                                 srcToDst, imageSize, src);
     *tileSize = kBmpSmallTileSize; // already know whole bitmap fits in one max sized tile.
     size_t usedTileBytes = get_tile_count(*clippedSubset, kBmpSmallTileSize) *
@@ -795,8 +791,8 @@
         int tileSize;
         SkIRect clippedSubset;
         if (should_tile_image_id(fContext.get(),
-                                 fSurfaceDrawContext->dimensions(),
-                                 clip,
+                                 clip ? clip->getConservativeBounds()
+                                      : SkIRect::MakeSize(fSurfaceDrawContext->dimensions()),
                                  image->unique(),
                                  image->dimensions(),
                                  ctm,