Alter approximate scratch texture binning after 1024

As the powers-of-2 get larger the coarse binning can burn a lot of VRAM.

Granted it isn't the best metric but, with this CL, the number of textures created and scratch textures reused remains unchanged when running the GMs.

Change-Id: I84abbbae0ed01aabb387671b5ee0e4fcdb82b671
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/226226
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrSurface.cpp b/src/gpu/GrSurface.cpp
index d29d50d..87d9e9c 100644
--- a/src/gpu/GrSurface.cpp
+++ b/src/gpu/GrSurface.cpp
@@ -16,15 +16,11 @@
 #include "src/core/SkMathPriv.h"
 #include "src/gpu/SkGr.h"
 
-size_t GrSurface::WorstCaseSize(const GrSurfaceDesc& desc, bool useNextPow2) {
+size_t GrSurface::WorstCaseSize(const GrSurfaceDesc& desc, bool binSize) {
     size_t size;
 
-    int width = useNextPow2
-                ? SkTMax(GrResourceProvider::kMinScratchTextureSize, GrNextPow2(desc.fWidth))
-                : desc.fWidth;
-    int height = useNextPow2
-                ? SkTMax(GrResourceProvider::kMinScratchTextureSize, GrNextPow2(desc.fHeight))
-                : desc.fHeight;
+    int width  = binSize ? GrResourceProvider::MakeApprox(desc.fWidth)  : desc.fWidth;
+    int height = binSize ? GrResourceProvider::MakeApprox(desc.fHeight) : desc.fHeight;
 
     bool isRenderTarget = SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag);
     if (isRenderTarget) {
@@ -63,15 +59,11 @@
                               int height,
                               int colorSamplesPerPixel,
                               GrMipMapped mipMapped,
-                              bool useNextPow2) {
+                              bool binSize) {
     size_t colorSize;
 
-    width = useNextPow2
-            ? SkTMax(GrResourceProvider::kMinScratchTextureSize, GrNextPow2(width))
-            : width;
-    height = useNextPow2
-            ? SkTMax(GrResourceProvider::kMinScratchTextureSize, GrNextPow2(height))
-            : height;
+    width  = binSize ? GrResourceProvider::MakeApprox(width)  : width;
+    height = binSize ? GrResourceProvider::MakeApprox(height) : height;
 
     SkASSERT(kUnknown_GrPixelConfig != config);
     if (GrPixelConfigIsCompressed(config)) {