Reland "Update FragmentProcessor TextureSampler to hold an GrSurfaceProxyView."

This reverts commit c5c024791bb7a587223b807e00ffba4a3eb5fdb7.

Reason for revert: Doh

Original change's description:
> Revert "Update FragmentProcessor TextureSampler to hold an GrSurfaceProxyView."
> 
> This reverts commit acf5929ae0addc5188117142fd3fb39828baa8d5.
> 
> Reason for revert: May be blocking Chrome roll
> Original change's description:
> > Update FragmentProcessor TextureSampler to hold an GrSurfaceProxyView.
> > 
> > In future CLs I will update the Ops that create the TextureSamplers to pass
> > the GrSurfaceProxyView in.
> > 
> > Bug: skia:9556
> > Change-Id: I550dab64974d32e4c3047188063efa2d0832328e
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259164
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> 
> TBR=egdaniel@google.com,michaelludwig@google.com
> 
> Change-Id: Ic804a52c5c6d16a13a9cc2d85bb959f305134177
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:9556
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259433
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

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

Change-Id: If2af5b5b323858e59c0c8db3b75477d74d78abfd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9556
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259434
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp
index 973ef45..9235bd3 100644
--- a/src/gpu/effects/GrBicubicEffect.cpp
+++ b/src/gpu/effects/GrBicubicEffect.cpp
@@ -145,8 +145,8 @@
 void GrGLBicubicEffect::onSetData(const GrGLSLProgramDataManager& pdman,
                                   const GrFragmentProcessor& processor) {
     const GrBicubicEffect& bicubicEffect = processor.cast<GrBicubicEffect>();
-    GrSurfaceProxy* proxy = processor.textureSampler(0).proxy();
-    SkISize textureDims = proxy->backingStoreDimensions();
+    const auto& view = processor.textureSampler(0).view();
+    SkISize textureDims = view.proxy()->backingStoreDimensions();
 
     float dims[4] = {0, 0, 0, 0};
     if (bicubicEffect.direction() != GrBicubicEffect::Direction::kY) {
@@ -158,7 +158,7 @@
         dims[3] = textureDims.height();
     }
     pdman.set4fv(fDimensions, 1, dims);
-    fDomain.setData(pdman, bicubicEffect.domain(), proxy,
+    fDomain.setData(pdman, bicubicEffect.domain(), view,
                     processor.textureSampler(0).samplerState());
 }
 
diff --git a/src/gpu/effects/GrCircleBlurFragmentProcessor.fp b/src/gpu/effects/GrCircleBlurFragmentProcessor.fp
index 4228a03..a710b2d 100644
--- a/src/gpu/effects/GrCircleBlurFragmentProcessor.fp
+++ b/src/gpu/effects/GrCircleBlurFragmentProcessor.fp
@@ -253,8 +253,6 @@
             if (!blurProfile) {
                 return nullptr;
             }
-
-            SkASSERT(blurProfile->origin() == kTopLeft_GrSurfaceOrigin);
             proxyProvider->assignUniqueKeyToProxy(key, blurProfile.get());
         }
 
diff --git a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
index cc6b8d2..80bc165 100644
--- a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
+++ b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
@@ -123,11 +123,12 @@
                                       const GrFragmentProcessor& processor) {
     const GrGaussianConvolutionFragmentProcessor& conv =
             processor.cast<GrGaussianConvolutionFragmentProcessor>();
-    GrSurfaceProxy* proxy = conv.textureSampler(0).proxy();
+    const auto& view = conv.textureSampler(0).view();
+    GrSurfaceProxy* proxy = view.proxy();
     GrTexture& texture = *proxy->peekTexture();
 
     float imageIncrement[2] = {0};
-    float ySign = proxy->origin() != kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;
+    float ySign = view.origin() != kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;
     switch (conv.direction()) {
         case Direction::kX:
             imageIncrement[0] = 1.0f / texture.width();
@@ -153,7 +154,7 @@
             bounds[1] *= inv;
         } else {
             SkScalar inv = SkScalarInvert(SkIntToScalar(texture.height()));
-            if (proxy->origin() != kTopLeft_GrSurfaceOrigin) {
+            if (view.origin() != kTopLeft_GrSurfaceOrigin) {
                 float tmp = bounds[0];
                 bounds[0] = 1.0f - (inv * bounds[1]);
                 bounds[1] = 1.0f - (inv * tmp);
diff --git a/src/gpu/effects/GrMagnifierEffect.fp b/src/gpu/effects/GrMagnifierEffect.fp
index e6a9aa2..fba7807 100644
--- a/src/gpu/effects/GrMagnifierEffect.fp
+++ b/src/gpu/effects/GrMagnifierEffect.fp
@@ -47,7 +47,7 @@
 
     {
         SkScalar y = srcRect.y() * invH;
-        if (srcProxy.origin() != kTopLeft_GrSurfaceOrigin) {
+        if (srcView.origin() != kTopLeft_GrSurfaceOrigin) {
             y = 1.0f - (srcRect.height() / bounds.height()) - y;
         }
 
@@ -57,7 +57,7 @@
     {
         SkScalar y = bounds.y() * invH;
         SkScalar hSign = 1.f;
-        if (srcProxy.origin() != kTopLeft_GrSurfaceOrigin) {
+        if (srcView.origin() != kTopLeft_GrSurfaceOrigin) {
             y = 1.0f - bounds.y() * invH;
             hSign = -1.f;
         }
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
index 1f70a53..12decaf 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
@@ -125,11 +125,11 @@
 void GrGLMatrixConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdman,
                                             const GrFragmentProcessor& processor) {
     const GrMatrixConvolutionEffect& conv = processor.cast<GrMatrixConvolutionEffect>();
-    GrSurfaceProxy* proxy = conv.textureSampler(0).proxy();
-    SkISize textureDims = proxy->backingStoreDimensions();
+    const auto& view = conv.textureSampler(0).view();
+    SkISize textureDims = view.proxy()->backingStoreDimensions();
 
     float imageIncrement[2];
-    float ySign = proxy->origin() == kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;
+    float ySign = view.origin() == kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;
     imageIncrement[0] = 1.0f / textureDims.width();
     imageIncrement[1] = ySign / textureDims.height();
     pdman.set2fv(fImageIncrementUni, 1, imageIncrement);
@@ -140,7 +140,7 @@
     pdman.set4fv(fKernelUni, arrayCount, conv.kernel());
     pdman.set1f(fGainUni, conv.gain());
     pdman.set1f(fBiasUni, conv.bias());
-    fDomain.setData(pdman, conv.domain(), proxy, conv.textureSampler(0).samplerState());
+    fDomain.setData(pdman, conv.domain(), view, conv.textureSampler(0).samplerState());
 }
 
 GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(sk_sp<GrSurfaceProxy> srcProxy,
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index a61ac18..d090cbd 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -222,22 +222,24 @@
 
 void GrTextureDomain::GLDomain::setData(const GrGLSLProgramDataManager& pdman,
                                         const GrTextureDomain& textureDomain,
-                                        const GrSurfaceProxy* proxy,
+                                        const GrSurfaceProxyView& view,
                                         const GrSamplerState& state) {
     // We want a hard transition from texture content to trans-black in nearest mode.
     bool filterDecal = state.filter() != GrSamplerState::Filter::kNearest;
-    this->setData(pdman, textureDomain, proxy, filterDecal);
+    this->setData(pdman, textureDomain, view.proxy(), view.origin(), filterDecal);
 }
 
 void GrTextureDomain::GLDomain::setData(const GrGLSLProgramDataManager& pdman,
                                         const GrTextureDomain& textureDomain,
                                         bool filterIfDecal) {
-    this->setData(pdman, textureDomain, nullptr, filterIfDecal);
+    // The origin we pass here doesn't matter
+    this->setData(pdman, textureDomain, nullptr, kTopLeft_GrSurfaceOrigin, filterIfDecal);
 }
 
 void GrTextureDomain::GLDomain::setData(const GrGLSLProgramDataManager& pdman,
                                         const GrTextureDomain& textureDomain,
                                         const GrSurfaceProxy* proxy,
+                                        GrSurfaceOrigin origin,
                                         bool filterIfDecal) {
     SkASSERT(fHasMode && textureDomain.modeX() == fModeX && textureDomain.modeY() == fModeY);
     if (kIgnore_Mode == textureDomain.modeX() && kIgnore_Mode == textureDomain.modeY()) {
@@ -290,7 +292,7 @@
         }
 
         // vertical flip if necessary
-        if (kBottomLeft_GrSurfaceOrigin == proxy->origin()) {
+        if (kBottomLeft_GrSurfaceOrigin == origin) {
             tempDomainValues[1] = h - tempDomainValues[1];
             tempDomainValues[3] = h - tempDomainValues[3];
 
@@ -438,7 +440,11 @@
                        const GrFragmentProcessor& fp) override {
             const GrDomainEffect& de = fp.cast<GrDomainEffect>();
             const GrTextureDomain& domain = de.fDomain;
-            fGLDomain.setData(pdman, domain, de.fCoordTransform.proxy(), de.fDecalIsFiltered);
+            // TODO: Update GrCoordTransform to return a view instead of proxy
+            const GrSurfaceProxy* proxy = de.fCoordTransform.proxy();
+            // If we don't have a proxy the value of the origin doesn't matter
+            GrSurfaceOrigin origin = proxy ? proxy->origin() : kTopLeft_GrSurfaceOrigin;
+            fGLDomain.setData(pdman, domain, proxy, origin, de.fDecalIsFiltered);
         }
 
     private:
@@ -559,10 +565,10 @@
                        const GrFragmentProcessor& fp) override {
             const GrDeviceSpaceTextureDecalFragmentProcessor& dstdfp =
                     fp.cast<GrDeviceSpaceTextureDecalFragmentProcessor>();
-            GrSurfaceProxy* proxy = dstdfp.textureSampler(0).proxy();
-            SkISize textureDims = proxy->backingStoreDimensions();
+            const auto& view = dstdfp.textureSampler(0).view();
+            SkISize textureDims = view.proxy()->backingStoreDimensions();
 
-            fGLDomain.setData(pdman, dstdfp.fTextureDomain, proxy,
+            fGLDomain.setData(pdman, dstdfp.fTextureDomain, view,
                               dstdfp.textureSampler(0).samplerState());
             float iw = 1.f / textureDims.width();
             float ih = 1.f / textureDims.height();
@@ -570,7 +576,7 @@
                 iw, ih,
                 -dstdfp.fDeviceSpaceOffset.fX * iw, -dstdfp.fDeviceSpaceOffset.fY * ih
             };
-            if (proxy->origin() == kBottomLeft_GrSurfaceOrigin) {
+            if (view.origin() == kBottomLeft_GrSurfaceOrigin) {
                 scaleAndTransData[1] = -scaleAndTransData[1];
                 scaleAndTransData[3] = 1 - scaleAndTransData[3];
             }
@@ -588,8 +594,8 @@
 bool GrDeviceSpaceTextureDecalFragmentProcessor::onIsEqual(const GrFragmentProcessor& fp) const {
     const GrDeviceSpaceTextureDecalFragmentProcessor& dstdfp =
             fp.cast<GrDeviceSpaceTextureDecalFragmentProcessor>();
-    return dstdfp.fTextureSampler.proxy()->underlyingUniqueID() ==
-                   fTextureSampler.proxy()->underlyingUniqueID() &&
+    return dstdfp.fTextureSampler.view().proxy()->underlyingUniqueID() ==
+                   fTextureSampler.view().proxy()->underlyingUniqueID() &&
            dstdfp.fDeviceSpaceOffset == fDeviceSpaceOffset &&
            dstdfp.fTextureDomain == fTextureDomain;
 }
diff --git a/src/gpu/effects/GrTextureDomain.h b/src/gpu/effects/GrTextureDomain.h
index 53f3fcb..88e6555 100644
--- a/src/gpu/effects/GrTextureDomain.h
+++ b/src/gpu/effects/GrTextureDomain.h
@@ -178,11 +178,11 @@
          * account for the texture's origin. Filtering at the edge of the domain is inferred from
          * the GrSamplerState's filter mode.
          */
-        void setData(const GrGLSLProgramDataManager&, const GrTextureDomain&, const GrSurfaceProxy*,
-                     const GrSamplerState& state);
+        void setData(const GrGLSLProgramDataManager&, const GrTextureDomain&,
+                     const GrSurfaceProxyView&, const GrSamplerState& state);
         /** Same as above but with direct control over decal filtering. */
         void setData(const GrGLSLProgramDataManager&, const GrTextureDomain&, const GrSurfaceProxy*,
-                     bool filterIfDecal);
+                     GrSurfaceOrigin, bool filterIfDecal);
 
         enum {
             kModeBits = 3,  // See DomainKey().
diff --git a/src/gpu/effects/GrYUVtoRGBEffect.cpp b/src/gpu/effects/GrYUVtoRGBEffect.cpp
index 8af97f1..4d2d732 100644
--- a/src/gpu/effects/GrYUVtoRGBEffect.cpp
+++ b/src/gpu/effects/GrYUVtoRGBEffect.cpp
@@ -100,8 +100,8 @@
     SkString str;
     for (int i = 0; i < this->numTextureSamplers(); ++i) {
         str.appendf("%d: %d %d ", i,
-                    this->textureSampler(i).proxy()->uniqueID().asUInt(),
-                    this->textureSampler(i).proxy()->underlyingUniqueID().asUInt());
+                    this->textureSampler(i).view().proxy()->uniqueID().asUInt(),
+                    this->textureSampler(i).view().proxy()->underlyingUniqueID().asUInt());
     }
     str.appendf("\n");
 
diff --git a/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp b/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp
index 3d5a925..863e88f 100644
--- a/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp
+++ b/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp
@@ -230,8 +230,6 @@
         if (!blurProfile) {
             return nullptr;
         }
-
-        SkASSERT(blurProfile->origin() == kTopLeft_GrSurfaceOrigin);
         proxyProvider->assignUniqueKeyToProxy(key, blurProfile.get());
     }
 
@@ -300,8 +298,8 @@
         (void)textureRadius;
         auto solidRadius = _outer.solidRadius;
         (void)solidRadius;
-        GrSurfaceProxy& blurProfileSamplerProxy = *_outer.textureSampler(0).proxy();
-        GrTexture& blurProfileSampler = *blurProfileSamplerProxy.peekTexture();
+        const GrSurfaceProxyView& blurProfileSamplerView = _outer.textureSampler(0).view();
+        GrTexture& blurProfileSampler = *blurProfileSamplerView.proxy()->peekTexture();
         (void)blurProfileSampler;
         UniformHandle& circleData = circleDataVar;
         (void)circleData;
diff --git a/src/gpu/effects/generated/GrMagnifierEffect.cpp b/src/gpu/effects/generated/GrMagnifierEffect.cpp
index 5a29834..a6522b5 100644
--- a/src/gpu/effects/generated/GrMagnifierEffect.cpp
+++ b/src/gpu/effects/generated/GrMagnifierEffect.cpp
@@ -85,8 +85,8 @@
             pdman.set1f(xInvInsetVar, (_outer.xInvInset));
             pdman.set1f(yInvInsetVar, (_outer.yInvInset));
         }
-        GrSurfaceProxy& srcProxy = *_outer.textureSampler(0).proxy();
-        GrTexture& src = *srcProxy.peekTexture();
+        const GrSurfaceProxyView& srcView = _outer.textureSampler(0).view();
+        GrTexture& src = *srcView.proxy()->peekTexture();
         (void)src;
         auto bounds = _outer.bounds;
         (void)bounds;
@@ -110,7 +110,7 @@
 
         {
             SkScalar y = srcRect.y() * invH;
-            if (srcProxy.origin() != kTopLeft_GrSurfaceOrigin) {
+            if (srcView.origin() != kTopLeft_GrSurfaceOrigin) {
                 y = 1.0f - (srcRect.height() / bounds.height()) - y;
             }
 
@@ -120,7 +120,7 @@
         {
             SkScalar y = bounds.y() * invH;
             SkScalar hSign = 1.f;
-            if (srcProxy.origin() != kTopLeft_GrSurfaceOrigin) {
+            if (srcView.origin() != kTopLeft_GrSurfaceOrigin) {
                 y = 1.0f - bounds.y() * invH;
                 hSign = -1.f;
             }
diff --git a/src/gpu/effects/generated/GrRRectBlurEffect.cpp b/src/gpu/effects/generated/GrRRectBlurEffect.cpp
index 35cf1fe..71f50d7 100644
--- a/src/gpu/effects/generated/GrRRectBlurEffect.cpp
+++ b/src/gpu/effects/generated/GrRRectBlurEffect.cpp
@@ -111,8 +111,8 @@
         (void)rect;
         UniformHandle& cornerRadius = cornerRadiusVar;
         (void)cornerRadius;
-        GrSurfaceProxy& ninePatchSamplerProxy = *_outer.textureSampler(0).proxy();
-        GrTexture& ninePatchSampler = *ninePatchSamplerProxy.peekTexture();
+        const GrSurfaceProxyView& ninePatchSamplerView = _outer.textureSampler(0).view();
+        GrTexture& ninePatchSampler = *ninePatchSamplerView.proxy()->peekTexture();
         (void)ninePatchSampler;
         UniformHandle& proxyRect = proxyRectVar;
         (void)proxyRect;
diff --git a/src/gpu/effects/generated/GrRectBlurEffect.cpp b/src/gpu/effects/generated/GrRectBlurEffect.cpp
index 7643406..8ba9506 100644
--- a/src/gpu/effects/generated/GrRectBlurEffect.cpp
+++ b/src/gpu/effects/generated/GrRectBlurEffect.cpp
@@ -132,8 +132,8 @@
         (void)rectF;
         UniformHandle& rectH = rectHVar;
         (void)rectH;
-        GrSurfaceProxy& integralProxy = *_outer.textureSampler(0).proxy();
-        GrTexture& integral = *integralProxy.peekTexture();
+        const GrSurfaceProxyView& integralView = _outer.textureSampler(0).view();
+        GrTexture& integral = *integralView.proxy()->peekTexture();
         (void)integral;
         UniformHandle& invSixSigma = invSixSigmaVar;
         (void)invSixSigma;