remove imagefilter::sizeconstraint

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1571033002

Review URL: https://codereview.chromium.org/1571033002
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 8f28ea4..e577b21 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1439,8 +1439,7 @@
             SkIRect clipBounds = iter.fClip->getBounds().makeOffset(-pos.x(), -pos.y());
 #endif
             SkAutoTUnref<SkImageFilter::Cache> cache(dstDev->getImageFilterCache());
-            SkImageFilter::Context ctx(matrix, clipBounds, cache.get(),
-                                       SkImageFilter::kApprox_SizeConstraint);
+            SkImageFilter::Context ctx(matrix, clipBounds, cache.get());
             if (filter->filterImage(&proxy, src, ctx, &dst, &offset)) {
                 SkPaint tmpUnfiltered(*paint);
                 tmpUnfiltered.setImageFilter(nullptr);
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index cc2f318..8ff5827 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -418,8 +418,7 @@
         const SkIRect clipBounds = draw.fClip->getBounds().makeOffset(-x, -y);
 #endif
         SkAutoTUnref<SkImageFilter::Cache> cache(this->getImageFilterCache());
-        SkImageFilter::Context ctx(matrix, clipBounds, cache.get(),
-                                   SkImageFilter::kApprox_SizeConstraint);
+        SkImageFilter::Context ctx(matrix, clipBounds, cache.get());
         if (filter->filterImage(&proxy, bitmap, ctx, &dst, &offset)) {
             SkPaint tmpUnfiltered(paint);
             tmpUnfiltered.setImageFilter(nullptr);
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index 7518501..e64cf72 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -265,25 +265,16 @@
 }
 
 bool SkImageFilter::filterInput(int index, Proxy* proxy, const SkBitmap& src,
-                                const Context& origCtx,
-                                SkBitmap* result, SkIPoint* offset,
-                                bool relaxSizeConstraint) const {
+                                const Context& ctx,
+                                SkBitmap* result, SkIPoint* offset) const {
     SkImageFilter* input = this->getInput(index);
     if (!input) {
         return true;
     }
-
-    SizeConstraint constraint = origCtx.sizeConstraint();
-    if (relaxSizeConstraint && (kExact_SizeConstraint == constraint)) {
-        constraint = kApprox_SizeConstraint;
-    }
-    Context ctx(origCtx.ctm(), origCtx.clipBounds(), origCtx.cache(), constraint);
-
     return input->filterImage(proxy, src, this->mapContext(ctx), result, offset);
 }
 
-bool SkImageFilter::filterBounds(const SkIRect& src, const SkMatrix& ctm,
-                                 SkIRect* dst) const {
+bool SkImageFilter::filterBounds(const SkIRect& src, const SkMatrix& ctm, SkIRect* dst) const {
     SkASSERT(dst);
     return this->onFilterBounds(src, ctm, dst);
 }
@@ -353,8 +344,7 @@
     desc.fHeight = bounds.height();
     desc.fConfig = kRGBA_8888_GrPixelConfig;
 
-    SkAutoTUnref<GrTexture> dst(context->textureProvider()->createTexture(desc,
-                                      GrTextureProvider::FromImageFilter(ctx.sizeConstraint())));
+    SkAutoTUnref<GrTexture> dst(context->textureProvider()->createApproxTexture(desc));
     if (!dst) {
         return false;
     }
@@ -488,7 +478,7 @@
     SkIRect clipBounds;
     this->onFilterNodeBounds(ctx.clipBounds(), ctx.ctm(), &clipBounds,
                              MapDirection::kReverse_MapDirection);
-    return Context(ctx.ctm(), clipBounds, ctx.cache(), ctx.sizeConstraint());
+    return Context(ctx.ctm(), clipBounds, ctx.cache());
 #endif
 }
 
@@ -519,7 +509,7 @@
 }
 
 bool SkImageFilter::filterInputGPU(int index, SkImageFilter::Proxy* proxy,
-                                   const SkBitmap& src, const Context& origCtx,
+                                   const SkBitmap& src, const Context& ctx,
                                    SkBitmap* result, SkIPoint* offset) const {
     SkImageFilter* input = this->getInput(index);
     if (!input) {
@@ -529,9 +519,6 @@
     // matrix with no clip and that the matrix, clip, and render target set before this function was
     // called are restored before we return to the caller.
     GrContext* context = src.getTexture()->getContext();
-
-    Context ctx(origCtx.ctm(), origCtx.clipBounds(), origCtx.cache(), kApprox_SizeConstraint);
-
     if (input->filterImage(proxy, src, this->mapContext(ctx), result, offset)) {
         if (!result->getTexture()) {
             const SkImageInfo info = result->info();
diff --git a/src/core/SkLocalMatrixImageFilter.cpp b/src/core/SkLocalMatrixImageFilter.cpp
index e4fc0ce..10d63ed 100644
--- a/src/core/SkLocalMatrixImageFilter.cpp
+++ b/src/core/SkLocalMatrixImageFilter.cpp
@@ -40,9 +40,8 @@
 
 bool SkLocalMatrixImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src, const Context& ctx,
                                              SkBitmap* result, SkIPoint* offset) const {
-    Context localCtx(SkMatrix::Concat(ctx.ctm(), fLocalM), ctx.clipBounds(), ctx.cache(),
-                     ctx.sizeConstraint());
-    return this->filterInput(0, proxy, src, localCtx, result, offset, false);
+    Context localCtx(SkMatrix::Concat(ctx.ctm(), fLocalM), ctx.clipBounds(), ctx.cache());
+    return this->filterInput(0, proxy, src, localCtx, result, offset);
 }
 
 bool SkLocalMatrixImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& matrix,
diff --git a/src/effects/SkBlurImageFilter.cpp b/src/effects/SkBlurImageFilter.cpp
index 752749b..97cc8a9 100644
--- a/src/effects/SkBlurImageFilter.cpp
+++ b/src/effects/SkBlurImageFilter.cpp
@@ -217,15 +217,13 @@
     srcBounds.offset(-srcOffset);
     dstBounds.offset(-srcOffset);
     SkRect srcBoundsF(SkRect::Make(srcBounds));
-    auto constraint = GrTextureProvider::FromImageFilter(ctx.sizeConstraint());
     SkAutoTUnref<GrTexture> tex(SkGpuBlurUtils::GaussianBlur(source->getContext(),
                                                              source,
                                                              false,
                                                              SkRect::Make(dstBounds),
                                                              &srcBoundsF,
                                                              sigma.x(),
-                                                             sigma.y(),
-                                                             constraint));
+                                                             sigma.y()));
     if (!tex) {
         return false;
     }
diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp
index a4dd702..ca448bc 100644
--- a/src/effects/SkBlurMaskFilter.cpp
+++ b/src/effects/SkBlurMaskFilter.cpp
@@ -1241,8 +1241,7 @@
     // gaussianBlur.  Otherwise, we need to save it for later compositing.
     bool isNormalBlur = (kNormal_SkBlurStyle == fBlurStyle);
     *result = SkGpuBlurUtils::GaussianBlur(context, src, isNormalBlur && canOverwriteSrc,
-                                           clipRect, nullptr, xformedSigma, xformedSigma,
-                                           GrTextureProvider::kApprox_SizeConstraint);
+                                           clipRect, nullptr, xformedSigma, xformedSigma);
     if (nullptr == *result) {
         return false;
     }
diff --git a/src/effects/SkComposeImageFilter.cpp b/src/effects/SkComposeImageFilter.cpp
index 5915955..a922d30 100644
--- a/src/effects/SkComposeImageFilter.cpp
+++ b/src/effects/SkComposeImageFilter.cpp
@@ -37,8 +37,8 @@
     outerMatrix.postTranslate(SkIntToScalar(-innerOffset.x()), SkIntToScalar(-innerOffset.y()));
     SkIRect clipBounds = ctx.clipBounds();
     clipBounds.offset(-innerOffset.x(), -innerOffset.y());
-    Context outerContext(outerMatrix, clipBounds, ctx.cache(), ctx.sizeConstraint());
-    if (!this->filterInput(0, proxy, tmp, outerContext, result, &outerOffset, false)) {
+    Context outerContext(outerMatrix, clipBounds, ctx.cache());
+    if (!this->filterInput(0, proxy, tmp, outerContext, result, &outerOffset)) {
         return false;
     }
 
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index 2b35036..c50b1f2 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -428,8 +428,7 @@
     desc.fHeight = bounds.height();
     desc.fConfig = kSkia8888_GrPixelConfig;
 
-    auto constraint = GrTextureProvider::FromImageFilter(ctx.sizeConstraint());
-    SkAutoTUnref<GrTexture> dst(context->textureProvider()->createTexture(desc, constraint));
+    SkAutoTUnref<GrTexture> dst(context->textureProvider()->createApproxTexture(desc));
 
     if (!dst) {
         return false;
diff --git a/src/effects/SkGpuBlurUtils.cpp b/src/effects/SkGpuBlurUtils.cpp
index 13b6b0a..77a8501 100644
--- a/src/effects/SkGpuBlurUtils.cpp
+++ b/src/effects/SkGpuBlurUtils.cpp
@@ -167,8 +167,7 @@
                         const SkRect& dstBounds,
                         const SkRect* srcBounds,
                         float sigmaX,
-                        float sigmaY,
-                        GrTextureProvider::SizeConstraint constraint) {
+                        float sigmaY) {
     SkASSERT(context);
     SkIRect clearRect;
     int scaleFactorX, radiusX;
@@ -211,12 +210,12 @@
     GrTexture* tempTexture;
     SkAutoTUnref<GrTexture> temp1, temp2;
 
-    temp1.reset(context->textureProvider()->createTexture(desc, constraint));
+    temp1.reset(context->textureProvider()->createApproxTexture(desc));
     dstTexture = temp1.get();
     if (canClobberSrc) {
         tempTexture = srcTexture;
     } else {
-        temp2.reset(context->textureProvider()->createTexture(desc, constraint));
+        temp2.reset(context->textureProvider()->createApproxTexture(desc));
         tempTexture = temp2.get();
     }
 
diff --git a/src/effects/SkGpuBlurUtils.h b/src/effects/SkGpuBlurUtils.h
index 84e3252..013d11b 100644
--- a/src/effects/SkGpuBlurUtils.h
+++ b/src/effects/SkGpuBlurUtils.h
@@ -40,8 +40,7 @@
                             const SkRect& dstBounds,
                             const SkRect* srcBounds,
                             float sigmaX,
-                            float sigmaY,
-                            GrTextureProvider::SizeConstraint);
+                            float sigmaY);
 #endif
 
 };
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index ac7488b..6c2ec72 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -383,8 +383,7 @@
     desc.fHeight = bounds.height();
     desc.fConfig = kRGBA_8888_GrPixelConfig;
 
-    auto constraint = GrTextureProvider::FromImageFilter(ctx.sizeConstraint());
-    SkAutoTUnref<GrTexture> dst(context->textureProvider()->createTexture(desc, constraint));
+    SkAutoTUnref<GrTexture> dst(context->textureProvider()->createApproxTexture(desc));
     if (!dst) {
         return false;
     }
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index 205fc0d..895000e 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -548,8 +548,7 @@
                       const SkIRect& rect,
                       GrMorphologyEffect::MorphologyType morphType,
                       SkISize radius,
-                      SkBitmap* dst,
-                      GrTextureProvider::SizeConstraint constraint) {
+                      SkBitmap* dst) {
     SkAutoTUnref<GrTexture> srcTexture(SkRef(input.getTexture()));
     SkASSERT(srcTexture);
     GrContext* context = srcTexture->getContext();
@@ -567,14 +566,7 @@
     SkIRect srcRect = rect;
 
     if (radius.fWidth > 0) {
-        GrTextureProvider::SizeConstraint horiConstraint = constraint;
-        if (radius.fHeight > 0) {
-            // Optimization: we will fall through and allocate the "real" texture after this one
-            // so ours can be approximate (likely faster to allocate)
-            horiConstraint = GrTextureProvider::kApprox_SizeConstraint;
-        }
-
-        GrTexture* scratch = context->textureProvider()->createTexture(desc, horiConstraint);
+        GrTexture* scratch = context->textureProvider()->createApproxTexture(desc);
         if (nullptr == scratch) {
             return false;
         }
@@ -598,7 +590,7 @@
         srcRect = dstRect;
     }
     if (radius.fHeight > 0) {
-        GrTexture* scratch = context->textureProvider()->createTexture(desc, constraint);
+        GrTexture* scratch = context->textureProvider()->createApproxTexture(desc);
         if (nullptr == scratch) {
             return false;
         }
@@ -656,8 +648,7 @@
 
     GrMorphologyEffect::MorphologyType type = dilate ? GrMorphologyEffect::kDilate_MorphologyType
                                                      : GrMorphologyEffect::kErode_MorphologyType;
-    if (!apply_morphology(input, srcBounds, type, SkISize::Make(width, height), result,
-                          GrTextureProvider::FromImageFilter(ctx.sizeConstraint()))) {
+    if (!apply_morphology(input, srcBounds, type, SkISize::Make(width, height), result)) {
         return false;
     }
     offset->fX = bounds.left();
diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp
index 38d1e5e..3ff6c49 100644
--- a/src/effects/SkXfermodeImageFilter.cpp
+++ b/src/effects/SkXfermodeImageFilter.cpp
@@ -155,8 +155,7 @@
     desc.fWidth = src.width();
     desc.fHeight = src.height();
     desc.fConfig = kSkia8888_GrPixelConfig;
-    auto constraint = GrTextureProvider::FromImageFilter(ctx.sizeConstraint());
-    SkAutoTUnref<GrTexture> dst(context->textureProvider()->createTexture(desc, constraint));
+    SkAutoTUnref<GrTexture> dst(context->textureProvider()->createApproxTexture(desc));
     if (!dst) {
         return false;
     }
diff --git a/src/gpu/GrLayerHoister.cpp b/src/gpu/GrLayerHoister.cpp
index 004e4d0..2c45a7f 100644
--- a/src/gpu/GrLayerHoister.cpp
+++ b/src/gpu/GrLayerHoister.cpp
@@ -311,7 +311,7 @@
     // This cache is transient, and is freed (along with all its contained
     // textures) when it goes out of scope.
     SkAutoTUnref<SkImageFilter::Cache> cache(SkImageFilter::Cache::Create(kDefaultCacheSize));
-    SkImageFilter::Context filterContext(totMat, clipBounds, cache, SkImageFilter::kApprox_SizeConstraint);
+    SkImageFilter::Context filterContext(totMat, clipBounds, cache);
 
     SkImageFilter::DeviceProxy proxy(device);
     const SkBitmap src = wrap_texture(layer->texture());
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 7c77ded..40da40a 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1157,7 +1157,7 @@
         SkAutoTUnref<SkImageFilter::Cache> cache(getImageFilterCache());
         // This cache is transient, and is freed (along with all its contained
         // textures) when it goes out of scope.
-        SkImageFilter::Context ctx(matrix, clipBounds, cache, SkImageFilter::kApprox_SizeConstraint);
+        SkImageFilter::Context ctx(matrix, clipBounds, cache);
         if (this->filterTexture(fContext, texture, w, h, filter, ctx, &filteredBitmap,
                                 &offset)) {
             texture = (GrTexture*) filteredBitmap.getTexture();
@@ -1323,7 +1323,7 @@
         // This cache is transient, and is freed (along with all its contained
         // textures) when it goes out of scope.
         SkAutoTUnref<SkImageFilter::Cache> cache(getImageFilterCache());
-        SkImageFilter::Context ctx(matrix, clipBounds, cache, SkImageFilter::kApprox_SizeConstraint);
+        SkImageFilter::Context ctx(matrix, clipBounds, cache);
         if (this->filterTexture(fContext, devTex, device->width(), device->height(),
                                 filter, ctx, &filteredBitmap, &offset)) {
             devTex = filteredBitmap.getTexture();