Remove peekProxy's side-effect behavior

Prior to this CL peekProxy could cause the conversion of YUVA planes to RGBA. This switches peekProxy back to just peeking.

In future Ganesh asTextureProxyRef is going to require a GrRecordingContext (bc it can actually do work). The options were to either add a GrRecordingContext parameter to peekProxy or remove its ability to do work (as in this CL).

Change-Id: I42d7dcd41f7c99a7712446d3f6629ffde91bfe5b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/197105
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/image/SkImage_GpuBase.cpp b/src/image/SkImage_GpuBase.cpp
index c94fe5f..a260740 100644
--- a/src/image/SkImage_GpuBase.cpp
+++ b/src/image/SkImage_GpuBase.cpp
@@ -247,21 +247,24 @@
 
 GrTexture* SkImage_GpuBase::onGetTexture() const {
     GrTextureProxy* proxy = this->peekProxy();
-    if (!proxy) {
-        return nullptr;
+    if (proxy && proxy->isInstantiated()) {
+        return proxy->peekTexture();
     }
 
-    sk_sp<GrTextureProxy> proxyRef = this->asTextureProxyRef();
-    if (!fContext->priv().resourceProvider() && !proxyRef->isInstantiated()) {
+    auto direct = fContext->priv().asDirectContext();
+    if (!direct) {
         // This image was created with a DDL context and cannot be instantiated.
         return nullptr;
     }
 
-    if (!proxy->instantiate(fContext->priv().resourceProvider())) {
+    sk_sp<GrTextureProxy> proxyRef = this->asTextureProxyRef();
+    SkASSERT(proxyRef && !proxyRef->isInstantiated());
+
+    if (!proxyRef->instantiate(direct->priv().resourceProvider())) {
         return nullptr;
     }
 
-    return proxy->peekTexture();
+    return proxyRef->peekTexture();
 }
 
 bool SkImage_GpuBase::onIsValid(GrContext* context) const {