Remove GrTextureProducer::DetermineDomainMode.

We now rely on GrTextureEffect and GrBicbicEffect
to determine if shader-based tiling is required.

GrTextureProducer is still responsible for noticing that
the proxy is approximate because GrTextureEffect doesn't
consider that in its basic Make() factory (as opposed to
MakeSubset()).

Change-Id: I8e1aeb9edbcfa73ea0bf80b5256ee1ca21fe9c81
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301985
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp
index 1df8006..385dec0 100644
--- a/src/gpu/effects/GrBicubicEffect.cpp
+++ b/src/gpu/effects/GrBicubicEffect.cpp
@@ -14,6 +14,7 @@
 #include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
 #include "src/gpu/glsl/GrGLSLProgramDataManager.h"
 #include "src/gpu/glsl/GrGLSLUniformHandler.h"
+#include <cmath>
 
 class GrBicubicEffect::Impl : public GrGLSLFragmentProcessor {
 public:
@@ -180,6 +181,34 @@
             new GrBicubicEffect(std::move(fp), kernel, direction, clamp)));
 }
 
+std::unique_ptr<GrFragmentProcessor> GrBicubicEffect::MakeSubset(
+        GrSurfaceProxyView view,
+        SkAlphaType alphaType,
+        const SkMatrix& matrix,
+        const GrSamplerState::WrapMode wrapX,
+        const GrSamplerState::WrapMode wrapY,
+        const SkRect& subset,
+        const SkRect& domain,
+        Kernel kernel,
+        Direction direction,
+        const GrCaps& caps) {
+    auto lowerBound = [](float x) { return std::floor(x - 1.5f) + 0.5f; };
+    auto upperBound = [](float x) { return std::floor(x + 1.5f) - 0.5f; };
+    SkRect expandedDomain {
+            lowerBound(domain.fLeft)  ,
+            upperBound(domain.fRight) ,
+            lowerBound(domain.fTop)   ,
+            upperBound(domain.fBottom)
+    };
+    GrSamplerState sampler(wrapX, wrapY, GrSamplerState::Filter::kNearest);
+    std::unique_ptr<GrFragmentProcessor> fp;
+    fp = GrTextureEffect::MakeSubset(
+            std::move(view), alphaType, SkMatrix::I(), sampler, subset, expandedDomain, caps);
+    auto clamp = kPremul_SkAlphaType == alphaType ? Clamp::kPremul : Clamp::kUnpremul;
+    return GrMatrixEffect::Make(matrix, std::unique_ptr<GrFragmentProcessor>(
+            new GrBicubicEffect(std::move(fp), kernel, direction, clamp)));
+}
+
 std::unique_ptr<GrFragmentProcessor> GrBicubicEffect::Make(std::unique_ptr<GrFragmentProcessor> fp,
                                                            SkAlphaType alphaType,
                                                            const SkMatrix& matrix,