Remove check for whole image in the cache in SkGpuDevice::shouldTileImage

This was never that well justified.

Review URL: https://codereview.chromium.org/1405383002
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index cb532fe..f8b3724 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -758,16 +758,12 @@
         return true;
     }
 
+    // If the image would only produce 4 tiles of the smaller size, don't bother tiling it.
     const size_t area = imageRect.width() * imageRect.height();
     if (area < 4 * kBmpSmallTileSize * kBmpSmallTileSize) {
         return false;
     }
 
-    // if the entire image/bitmap is already in our cache then no reason to tile it
-    if (GrIsImageInCache(fContext, imageID, imageRect, nullptr, params)) {
-        return false;
-    }
-
     // At this point we know we could do the draw by uploading the entire bitmap
     // as a texture. However, if the texture would be large compared to the
     // cache size and we don't require most of it for this draw then tile to
@@ -782,7 +778,8 @@
         return false;
     }
 
-    // Figure out how much of the src we will need based on the src rect and clipping.
+    // 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%.
     determine_clipped_src_rect(fRenderTarget, fClip, viewMatrix, imageRect.size(), srcRectPtr,
                                clippedSubset);
     *tileSize = kBmpSmallTileSize; // already know whole bitmap fits in one max sized tile.
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 50cd5fa..1813433 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -173,14 +173,6 @@
     }
 }
 
-static void make_image_keys(uint32_t imageID, const SkIRect& subset, const SkGrStretch& stretch,
-                            GrUniqueKey* key, GrUniqueKey* stretchedKey) {
-    make_unstretched_key(key, imageID, subset);
-    if (SkGrStretch::kNone_Type != stretch.fType) {
-        GrMakeStretchedKey(*key, stretch, stretchedKey);
-    }
-}
-
 GrSurfaceDesc GrImageInfoToSurfaceDesc(const SkImageInfo& info) {
     GrSurfaceDesc desc;
     desc.fFlags = kNone_GrSurfaceFlags;
@@ -476,31 +468,6 @@
     return stretched;
 }
 
-bool GrIsImageInCache(const GrContext* ctx, uint32_t imageID, const SkIRect& subset,
-                      GrTexture* nativeTexture, const GrTextureParams& params) {
-    SkGrStretch stretch;
-    get_stretch(*ctx->caps(), subset.width(), subset.height(), params, &stretch);
-
-    // Handle the case where the bitmap/image is explicitly texture backed.
-    if (nativeTexture) {
-        if (SkGrStretch::kNone_Type == stretch.fType) {
-            return true;
-        }
-        const GrUniqueKey& key = nativeTexture->getUniqueKey();
-        if (!key.isValid()) {
-            return false;
-        }
-        GrUniqueKey stretchedKey;
-        GrMakeStretchedKey(key, stretch, &stretchedKey);
-        return ctx->textureProvider()->existsTextureWithUniqueKey(stretchedKey);
-    }
-
-    GrUniqueKey key, stretchedKey;
-    make_image_keys(imageID, subset, stretch, &key, &stretchedKey);
-    return ctx->textureProvider()->existsTextureWithUniqueKey(
-        (SkGrStretch::kNone_Type == stretch.fType) ? key : stretchedKey);
-}
-
 class Bitmap_GrTextureMaker : public GrTextureMaker {
 public:
     Bitmap_GrTextureMaker(const SkBitmap& bitmap)
diff --git a/src/gpu/SkGrPriv.h b/src/gpu/SkGrPriv.h
index 6c9f731..c92e580 100644
--- a/src/gpu/SkGrPriv.h
+++ b/src/gpu/SkGrPriv.h
@@ -114,9 +114,6 @@
                                                  int expectedW, int expectedH,
                                                  const void** outStartOfDataToUpload);
 
-bool GrIsImageInCache(const GrContext* ctx, uint32_t imageID, const SkIRect& subset,
-                      GrTexture* nativeTexture, const GrTextureParams&);
-
 GrTexture* GrCreateTextureForPixels(GrContext*, const GrUniqueKey& optionalKey, GrSurfaceDesc,
                                     SkPixelRef* pixelRefForInvalidationNotificationOrNull,
                                     const void* pixels, size_t rowBytesOrZero);