Always force GPU generated masks be top left (take 2)

Bug: 878195
Change-Id: Ie5d890597926f160743188ff1011f33e078f3d8f
Reviewed-on: https://skia-review.googlesource.com/150466
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/core/SkGpuBlurUtils.cpp b/src/core/SkGpuBlurUtils.cpp
index 15d6fa5..b97e628 100644
--- a/src/core/SkGpuBlurUtils.cpp
+++ b/src/core/SkGpuBlurUtils.cpp
@@ -120,7 +120,9 @@
     sk_sp<GrRenderTargetContext> renderTargetContext;
     renderTargetContext = context->contextPriv().makeDeferredRenderTargetContext(
                                                          dstFit, dstII.width(), dstII.height(),
-                                                         config, dstII.refColorSpace());
+                                                         config, dstII.refColorSpace(),
+                                                         1, GrMipMapped::kNo,
+                                                         proxy->origin());
     if (!renderTargetContext) {
         return nullptr;
     }
@@ -162,7 +164,9 @@
                                                                 fit, srcRect.width(),
                                                                 srcRect.height(),
                                                                 config,
-                                                                dstII.refColorSpace());
+                                                                dstII.refColorSpace(),
+                                                                1, GrMipMapped::kNo,
+                                                                proxy->origin());
     if (!dstRenderTargetContext) {
         return nullptr;
     }
@@ -279,7 +283,9 @@
                                                     SkBackingFit::kApprox,
                                                     dstRect.fRight,
                                                     dstRect.fBottom,
-                                                    config, dstII.refColorSpace());
+                                                    config, dstII.refColorSpace(),
+                                                    1, GrMipMapped::kNo,
+                                                    src->origin());
         if (!dstRenderTargetContext) {
             return nullptr;
         }
@@ -377,7 +383,9 @@
 
     sk_sp<GrRenderTargetContext> dstRenderTargetContext =
         context->contextPriv().makeDeferredRenderTargetContext(fit, dstII.width(), dstII.height(),
-                                                               config, dstII.refColorSpace());
+                                                               config, dstII.refColorSpace(),
+                                                               1, GrMipMapped::kNo,
+                                                               srcProxy->origin());
     if (!dstRenderTargetContext) {
         return nullptr;
     }
@@ -532,6 +540,7 @@
                                           mode, finalDestII, fit);
     }
 
+    SkASSERT(!dstRenderTargetContext || dstRenderTargetContext->origin() == srcProxy->origin());
     return dstRenderTargetContext;
 }
 
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index 7680b7d..3535df9 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -156,6 +156,8 @@
             return false;
         }
 
+        SkASSERT(kTopLeft_GrSurfaceOrigin == filteredMask->origin());
+
         drawRect = dstM.fBounds;
 
         if (key.isValid()) {
@@ -176,7 +178,7 @@
     sk_sp<GrRenderTargetContext> rtContext(
         context->contextPriv().makeDeferredRenderTargetContextWithFallback(
             SkBackingFit::kApprox, maskRect.width(), maskRect.height(), kAlpha_8_GrPixelConfig,
-            nullptr, sampleCnt));
+            nullptr, sampleCnt, GrMipMapped::kNo, kTopLeft_GrSurfaceOrigin));
     if (!rtContext) {
         return nullptr;
     }
@@ -387,7 +389,7 @@
         if (maskKey.isValid()) {
             // TODO: this cache look up is duplicated in sw_draw_with_mask_filter for raster
             filteredMask = proxyProvider->findOrCreateProxyByUniqueKey(
-                                                maskKey, renderTargetContext->origin());
+                                                maskKey, kTopLeft_GrSurfaceOrigin);
         }
 
         if (!filteredMask) {
@@ -402,6 +404,8 @@
                                                          std::move(maskProxy),
                                                          viewMatrix,
                                                          maskRect);
+                SkASSERT(kTopLeft_GrSurfaceOrigin == filteredMask->origin());
+
                 if (filteredMask && maskKey.isValid()) {
                     proxyProvider->assignUniqueKeyToProxy(maskKey, filteredMask.get());
                 }