Revert "Use "clamp" when reexpanding gaussian blurs"

This reverts commit f19510e320a08c76c9c1fddfbe28701c103d348a.

Reason for revert: chrome layout tests need rebasing

Original change's description:
> Use "clamp" when reexpanding gaussian blurs
> 
> Bug: skia:
> Change-Id: Ib0a59a56b38eb743f0c78de2cf717d04c775c8df
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/240666
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>

TBR=robertphillips@google.com,csmartdalton@google.com,michaelludwig@google.com

Change-Id: I53b3a16259ea9a9d1863be85fd5f2e0f1383ff3b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/241277
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
diff --git a/src/core/SkGpuBlurUtils.cpp b/src/core/SkGpuBlurUtils.cpp
index 038ab9c..5a1864c 100644
--- a/src/core/SkGpuBlurUtils.cpp
+++ b/src/core/SkGpuBlurUtils.cpp
@@ -409,6 +409,7 @@
         std::unique_ptr<GrRenderTargetContext> srcRenderTargetContext,
         const SkIRect& localSrcBounds,
         int scaleFactorX, int scaleFactorY,
+        GrTextureDomain::Mode mode,
         int finalW,
         int finalH,
         sk_sp<SkColorSpace> finalCS,
@@ -416,6 +417,14 @@
     const SkIRect srcRect = SkIRect::MakeWH(srcRenderTargetContext->width(),
                                             srcRenderTargetContext->height());
 
+    // Clear one pixel to the right and below, to accommodate bilinear upsampling.
+    // TODO: it seems like we should actually be clamping here rather than darkening
+    // the bottom right edges.
+    SkIRect clearRect = SkIRect::MakeXYWH(srcRect.fLeft, srcRect.fBottom, srcRect.width() + 1, 1);
+    srcRenderTargetContext->priv().absClear(&clearRect);
+    clearRect = SkIRect::MakeXYWH(srcRect.fRight, srcRect.fTop, 1, srcRect.height());
+    srcRenderTargetContext->priv().absClear(&clearRect);
+
     sk_sp<GrTextureProxy> srcProxy = srcRenderTargetContext->asTextureProxyRef();
     if (!srcProxy) {
         return nullptr;
@@ -434,12 +443,24 @@
     }
 
     GrPaint paint;
-    SkRect domain = GrTextureDomain::MakeTexelDomain(localSrcBounds, GrTextureDomain::kClamp_Mode,
-                                                     GrTextureDomain::kClamp_Mode);
-    auto fp = GrTextureDomainEffect::Make(std::move(srcProxy), SkMatrix::I(), domain,
-                                          GrTextureDomain::kClamp_Mode,
-                                          GrSamplerState::Filter::kBilerp);
-    paint.addColorFragmentProcessor(std::move(fp));
+    if (GrTextureDomain::kIgnore_Mode != mode) {
+        // GrTextureDomainEffect does not support kRepeat_Mode with GrSamplerState::Filter.
+        GrTextureDomain::Mode modeForScaling = GrTextureDomain::kRepeat_Mode == mode
+                                                            ? GrTextureDomain::kDecal_Mode
+                                                            : mode;
+
+        SkRect domain = SkRect::Make(localSrcBounds);
+        auto fp = GrTextureDomainEffect::Make(std::move(srcProxy),
+                                                SkMatrix::I(),
+                                                domain,
+                                                modeForScaling,
+                                                GrSamplerState::Filter::kBilerp);
+        paint.addColorFragmentProcessor(std::move(fp));
+    } else {
+        // FIXME:  this should be mitchell, not bilinear.
+        paint.addColorTextureProcessor(std::move(srcProxy), SkMatrix::I(),
+                                       GrSamplerState::ClampBilerp());
+    }
     paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
     GrFixedClip clip(SkIRect::MakeWH(finalW, finalH));
 
@@ -571,7 +592,7 @@
     if (scaleFactorX > 1 || scaleFactorY > 1) {
         dstRenderTargetContext =
                 reexpand(context, std::move(dstRenderTargetContext), localSrcBounds, scaleFactorX,
-                         scaleFactorY, finalW, finalH, colorSpace, fit);
+                         scaleFactorY, mode, finalW, finalH, colorSpace, fit);
     }
 
     SkASSERT(!dstRenderTargetContext || dstRenderTargetContext->origin() == srcProxy->origin());