Revert "Pass origins through the flushSurfaces calls."

This reverts commit ec3408169b937c66e72957bdeef737fbf96d94fb.

Reason for revert: This change actually isn't needed since a follow on change removes the use of origin from flushSurface anyways

Original change's description:
> Pass origins through the flushSurfaces calls.
> 
> Bug: skia:9556
> Change-Id: Ie4a0b33dd35e50b93c30cb0010f60c2893140661
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270439
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>

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

Change-Id: I4ea086d13d0bbef16c59e0abe2c42eb1eb6bf747
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9556
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270640
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrContextPriv.cpp b/src/gpu/GrContextPriv.cpp
index f1f0d86..e033ffa 100644
--- a/src/gpu/GrContextPriv.cpp
+++ b/src/gpu/GrContextPriv.cpp
@@ -40,8 +40,7 @@
     fContext->addOnFlushCallbackObject(onFlushCBObject);
 }
 
-GrSemaphoresSubmitted GrContextPriv::flushSurfaces(GrSurfaceProxy* proxies[],
-                                                   GrSurfaceOrigin origins[], int numProxies,
+GrSemaphoresSubmitted GrContextPriv::flushSurfaces(GrSurfaceProxy* proxies[], int numProxies,
                                                    const GrFlushInfo& info) {
     ASSERT_SINGLE_OWNER
     RETURN_VALUE_IF_ABANDONED(GrSemaphoresSubmitted::kNo)
@@ -53,12 +52,11 @@
         ASSERT_OWNED_PROXY(proxies[i]);
     }
     return fContext->drawingManager()->flushSurfaces(
-            proxies, origins, numProxies, SkSurface::BackendSurfaceAccess::kNoAccess, info);
+            proxies, numProxies, SkSurface::BackendSurfaceAccess::kNoAccess, info);
 }
 
-void GrContextPriv::flushSurface(GrSurfaceProxy* proxy, GrSurfaceOrigin origin) {
-    SkASSERT(proxy);
-    this->flushSurfaces(&proxy, &origin, 1, {});
+void GrContextPriv::flushSurface(GrSurfaceProxy* proxy) {
+    this->flushSurfaces(proxy ? &proxy : nullptr, proxy ? 1 : 0, {});
 }
 
 void GrContextPriv::moveRenderTasksToDDL(SkDeferredDisplayList* ddl) {
diff --git a/src/gpu/GrContextPriv.h b/src/gpu/GrContextPriv.h
index 28201ae..8e78956 100644
--- a/src/gpu/GrContextPriv.h
+++ b/src/gpu/GrContextPriv.h
@@ -86,16 +86,11 @@
      * GrContext will detect when it must perform a resolve before reading pixels back from the
      * surface or using it as a texture.
      */
-    GrSemaphoresSubmitted flushSurfaces(GrSurfaceProxy*[], GrSurfaceOrigin[], int numProxies,
-                                        const GrFlushInfo&);
+    GrSemaphoresSubmitted flushSurfaces(GrSurfaceProxy*[], int numProxies, const GrFlushInfo&);
 
-    /** Version of above that flushes for a single proxy and uses a default GrFlushInfo. Null is not
-     * allowed for the proxy. */
-    void flushSurface(GrSurfaceProxy*, GrSurfaceOrigin);
-
-    void flushSurface() {
-        this->flushSurfaces(nullptr, nullptr, 0, {});
-    }
+    /** Version of above that flushes for a single proxy and uses a default GrFlushInfo. Null is
+     * allowed. */
+    void flushSurface(GrSurfaceProxy*);
 
     /**
      * Returns true if createPMToUPMEffect and createUPMToPMEffect will succeed. In other words,
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 961c603..68f57f1 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -494,8 +494,7 @@
     return anyRenderTasksExecuted;
 }
 
-GrSemaphoresSubmitted GrDrawingManager::flushSurfaces(GrSurfaceProxy* proxies[],
-                                                      GrSurfaceOrigin origins[], int numProxies,
+GrSemaphoresSubmitted GrDrawingManager::flushSurfaces(GrSurfaceProxy* proxies[], int numProxies,
                                                       SkSurface::BackendSurfaceAccess access,
                                                       const GrFlushInfo& info) {
     if (this->wasAbandoned()) {
@@ -535,7 +534,7 @@
             if (rtProxy->isMSAADirty()) {
                 SkASSERT(rtProxy->peekRenderTarget());
                 gpu->resolveRenderTarget(rtProxy->peekRenderTarget(), rtProxy->msaaDirtyRect(),
-                                         origins[i], GrGpu::ForExternalIO::kYes);
+                                         rtProxy->origin(), GrGpu::ForExternalIO::kYes);
                 rtProxy->markMSAAResolved();
             }
         }
diff --git a/src/gpu/GrDrawingManager.h b/src/gpu/GrDrawingManager.h
index 752973a..8bb64e3 100644
--- a/src/gpu/GrDrawingManager.h
+++ b/src/gpu/GrDrawingManager.h
@@ -93,14 +93,13 @@
     static bool ProgramUnitTest(GrContext* context, int maxStages, int maxLevels);
 
     GrSemaphoresSubmitted flushSurfaces(GrSurfaceProxy* proxies[],
-                                        GrSurfaceOrigin origins[],
                                         int cnt,
                                         SkSurface::BackendSurfaceAccess access,
                                         const GrFlushInfo& info);
-    GrSemaphoresSubmitted flushSurface(GrSurfaceProxy* proxy, GrSurfaceOrigin origin,
+    GrSemaphoresSubmitted flushSurface(GrSurfaceProxy* proxy,
                                        SkSurface::BackendSurfaceAccess access,
                                        const GrFlushInfo& info) {
-        return this->flushSurfaces(&proxy, &origin, 1, access, info);
+        return this->flushSurfaces(&proxy, 1, access, info);
     }
 
     void addOnFlushCallbackObject(GrOnFlushCallbackObject*);
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 65abda8..6a08e46 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -2164,8 +2164,7 @@
     SkDEBUGCODE(this->validate();)
     GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContext", "flush", fContext);
 
-    return this->drawingManager()->flushSurface(this->asSurfaceProxy(), this->origin(), access,
-                                                info);
+    return this->drawingManager()->flushSurface(this->asSurfaceProxy(), access, info);
 }
 
 bool GrRenderTargetContext::waitOnSemaphores(int numSemaphores,
diff --git a/src/gpu/GrSurfaceContext.cpp b/src/gpu/GrSurfaceContext.cpp
index 88b5962..5c4e04a 100644
--- a/src/gpu/GrSurfaceContext.cpp
+++ b/src/gpu/GrSurfaceContext.cpp
@@ -240,7 +240,7 @@
         return tempCtx->readPixels(dstInfo, dst, rowBytes, {0, 0}, direct);
     }
 
-    bool flip = this->origin() == kBottomLeft_GrSurfaceOrigin;
+    bool flip = srcProxy->origin() == kBottomLeft_GrSurfaceOrigin;
 
     auto supportedRead = caps->supportedReadPixelsColorType(
             this->colorInfo().colorType(), srcProxy->backendFormat(), dstInfo.colorType());
@@ -267,7 +267,7 @@
         pt.fY = flip ? srcSurface->height() - pt.fY - dstInfo.height() : pt.fY;
     }
 
-    direct->priv().flushSurface(srcProxy, this->origin());
+    direct->priv().flushSurface(srcProxy);
 
     if (!direct->priv().getGpu()->readPixels(srcSurface, pt.fX, pt.fY, dstInfo.width(),
                                              dstInfo.height(), this->colorInfo().colorType(),
@@ -378,7 +378,7 @@
         // we can use a draw instead which doesn't have this origin restriction. Thus for render
         // targets we will use top left and otherwise we will make the origins match.
         GrSurfaceOrigin tempOrigin =
-                this->asRenderTargetContext() ? kTopLeft_GrSurfaceOrigin : this->origin();
+                this->asRenderTargetContext() ? kTopLeft_GrSurfaceOrigin : dstProxy->origin();
         auto tempProxy = direct->priv().proxyProvider()->createProxy(
                 format, srcInfo.dimensions(), tempReadSwizzle, GrRenderable::kNo, 1, tempOrigin,
                 GrMipMapped::kNo, SkBackingFit::kApprox, SkBudgeted::kYes, GrProtected::kNo);
@@ -436,7 +436,7 @@
             caps->supportedWritePixelsColorType(this->colorInfo().colorType(),
                                                 dstProxy->backendFormat(),
                                                 srcInfo.colorType()).fColorType;
-    bool flip = this->origin() == kBottomLeft_GrSurfaceOrigin;
+    bool flip = dstProxy->origin() == kBottomLeft_GrSurfaceOrigin;
     bool makeTight = !caps->writePixelsRowBytesSupport() && rowBytes != tightRowBytes;
     bool convert = premul || unpremul || needColorConversion || makeTight ||
                    (srcInfo.colorType() != allowedColorType) || flip;
@@ -462,11 +462,7 @@
     // giving the drawing manager the chance of skipping the flush (i.e., by passing in the
     // destination proxy)
     // TODO: should this policy decision just be moved into the drawing manager?
-    if (caps->preferVRAMUseOverFlushes()) {
-        direct->priv().flushSurface(dstProxy, this->origin());
-    } else {
-        direct->priv().flushSurface();
-    }
+    direct->priv().flushSurface(caps->preferVRAMUseOverFlushes() ? dstProxy : nullptr);
 
     return direct->priv().getGpu()->writePixels(dstSurface, pt.fX, pt.fY, srcInfo.width(),
                                                 srcInfo.height(), this->colorInfo().colorType(),
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index b8a7595..18728a4 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -71,8 +71,7 @@
     }
 
     GrSurfaceProxy* p[1] = {fView.proxy()};
-    GrSurfaceOrigin origin = fView.origin();
-    return context->priv().flushSurfaces(p, &origin, 1, info);
+    return context->priv().flushSurfaces(p, 1, info);
 }
 
 sk_sp<SkImage> SkImage_Gpu::onMakeColorTypeAndColorSpace(GrRecordingContext* context,
@@ -561,7 +560,7 @@
     sk_sp<GrTexture> texture = sk_ref_sp(view.proxy()->peekTexture());
 
     // Flush any writes or uploads
-    context->priv().flushSurface(view.proxy(), view.origin());
+    context->priv().flushSurface(view.proxy());
     GrGpu* gpu = context->priv().getGpu();
 
     std::unique_ptr<GrSemaphore> sema = gpu->prepareTextureForCrossContextUsage(texture.get());
@@ -698,11 +697,8 @@
         return false;
     }
 
-    const GrSurfaceProxyView* view = as_IB(image)->view(ctx);
-    SkASSERT(view);
-
     // Flush any pending IO on the texture.
-    ctx->priv().flushSurface(view->proxy(), view->origin());
+    ctx->priv().flushSurface(as_IB(image)->peekProxy());
 
     // We must make a copy of the image if the image is not unique, if the GrTexture owned by the
     // image is not unique, or if the texture wraps an external object.
@@ -719,11 +715,8 @@
             return false;
         }
 
-        view = as_IB(image)->view(ctx);
-        SkASSERT(view);
-
         // Flush to ensure that the copy is completed before we return the texture.
-        ctx->priv().flushSurface(view->proxy(), view->origin());
+        ctx->priv().flushSurface(as_IB(image)->peekProxy());
     }
 
     SkASSERT(!texture->resourcePriv().refsWrappedObjects());
diff --git a/src/image/SkImage_GpuBase.cpp b/src/image/SkImage_GpuBase.cpp
index 3d0f3c7..563d290 100644
--- a/src/image/SkImage_GpuBase.cpp
+++ b/src/image/SkImage_GpuBase.cpp
@@ -221,7 +221,7 @@
     GrTexture* texture = proxy->peekTexture();
     if (texture) {
         if (flushPendingGrContextIO) {
-            direct->priv().flushSurface(proxy, view->origin());
+            direct->priv().flushSurface(proxy);
         }
         if (origin) {
             *origin = proxy->origin();
diff --git a/src/image/SkImage_GpuYUVA.cpp b/src/image/SkImage_GpuYUVA.cpp
index 1c0505f..2f7ced0 100644
--- a/src/image/SkImage_GpuYUVA.cpp
+++ b/src/image/SkImage_GpuYUVA.cpp
@@ -119,18 +119,15 @@
 
     GrSurfaceProxy* proxies[4] = {fViews[0].proxy(), fViews[1].proxy(), fViews[2].proxy(),
                                   fViews[3].proxy()};
-    GrSurfaceOrigin origins[4] = {fViews[0].origin(), fViews[1].origin(), fViews[2].origin(),
-                                  fViews[3].origin()};
     int numProxies = fNumViews;
     if (fRGBView.proxy()) {
         // Either we've already flushed the flattening draw or the flattening is unflushed. In the
         // latter case it should still be ok to just pass fRGBView proxy because it in turn depends
         // on the planar proxies and will cause all of their work to flush as well.
         proxies[0] = fRGBView.proxy();
-        origins[0] = fRGBView.origin();
         numProxies = 1;
     }
-    return context->priv().flushSurfaces(proxies, origins, numProxies, info);
+    return context->priv().flushSurfaces(proxies, numProxies, info);
 }
 
 GrTextureProxy* SkImage_GpuYUVA::peekProxy() const { return fRGBView.asTextureProxy(); }