Revert "Make rest of GrGpu::wrapBackend* methods take a GrColorType"

This reverts commit 9725638fb1aed02cd7e6b2945d0a42e620724f76.

Reason for revert: Chrome roll

Original change's description:
> Make rest of GrGpu::wrapBackend* methods take a GrColorType
> 
> This CL is intended to further wean Ganesh off of using the GrBackendTexture's pixel config
> 
> Bug: skia:6718
> Change-Id: I593c0c73922fb76045e379214e20adb1f17ea215
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/227780
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>

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

Change-Id: Id71acf1dec63c288a858fccd7109c84cf3cc6f0a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:6718
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/228337
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrBackendTextureImageGenerator.cpp b/src/gpu/GrBackendTextureImageGenerator.cpp
index 56e91a2..a62dfab 100644
--- a/src/gpu/GrBackendTextureImageGenerator.cpp
+++ b/src/gpu/GrBackendTextureImageGenerator.cpp
@@ -51,20 +51,15 @@
     context->priv().getResourceCache()->insertDelayedResourceUnref(texture.get());
 
     GrBackendTexture backendTexture = texture->getBackendTexture();
-
-    // TODO: delete this block
-    {
-        GrBackendFormat backendFormat = backendTexture.getBackendFormat();
-        if (!backendFormat.isValid()) {
-            return nullptr;
-        }
-
-        backendTexture.fConfig = context->priv().caps()->getConfigFromBackendFormat(
-                                                            backendFormat,
-                                                            SkColorTypeToGrColorType(colorType));
-        if (backendTexture.fConfig == kUnknown_GrPixelConfig) {
-            return nullptr;
-        }
+    GrBackendFormat backendFormat = backendTexture.getBackendFormat();
+    if (!backendFormat.isValid()) {
+        return nullptr;
+    }
+    backendTexture.fConfig =
+            context->priv().caps()->getConfigFromBackendFormat(backendFormat,
+                                                               SkColorTypeToGrColorType(colorType));
+    if (backendTexture.fConfig == kUnknown_GrPixelConfig) {
+        return nullptr;
     }
 
     SkImageInfo info = SkImageInfo::Make(texture->width(), texture->height(), colorType, alphaType,
@@ -84,6 +79,7 @@
         , fRefHelper(new RefHelper(texture, owningContextID))
         , fSemaphore(std::move(semaphore))
         , fBackendTexture(backendTex)
+        , fConfig(backendTex.config())
         , fSurfaceOrigin(origin) {}
 
 GrBackendTextureImageGenerator::~GrBackendTextureImageGenerator() {
@@ -114,7 +110,6 @@
     }
 
     auto proxyProvider = context->priv().proxyProvider();
-    const GrCaps* caps = context->priv().caps();
 
     fBorrowingMutex.acquire();
     sk_sp<GrRefCntedCallback> releaseProcHelper;
@@ -146,32 +141,20 @@
 
     SkASSERT(fRefHelper->fBorrowingContextID == context->priv().contextID());
 
-
-    GrBackendFormat backendFormat = fBackendTexture.getBackendFormat();
-    SkASSERT(backendFormat.isValid());
-
-    GrColorType grColorType = SkColorTypeToGrColorType(info.colorType());
-
-    GrPixelConfig config = caps->getConfigFromBackendFormat(backendFormat, grColorType);
-    if (kUnknown_GrPixelConfig == config) {
-        return nullptr;
-    }
-
-    SkASSERT(GrCaps::AreConfigsCompatible(fBackendTexture.config(),
-                                          caps->getConfigFromBackendFormat(backendFormat,
-                                                                           grColorType)));
-
     GrSurfaceDesc desc;
     desc.fWidth = fBackendTexture.width();
     desc.fHeight = fBackendTexture.height();
-    desc.fConfig = config;
+    desc.fConfig = fConfig;
     GrMipMapped mipMapped = fBackendTexture.hasMipMaps() ? GrMipMapped::kYes : GrMipMapped::kNo;
 
+    GrBackendFormat format = fBackendTexture.getBackendFormat();
+    SkASSERT(format.isValid());
+
     // Must make copies of member variables to capture in the lambda since this image generator may
     // be deleted before we actually execute the lambda.
     sk_sp<GrTextureProxy> proxy = proxyProvider->createLazyProxy(
             [refHelper = fRefHelper, releaseProcHelper, semaphore = fSemaphore,
-             backendTexture = fBackendTexture, grColorType](GrResourceProvider* resourceProvider)
+             backendTexture = fBackendTexture](GrResourceProvider* resourceProvider)
                     -> GrSurfaceProxy::LazyInstantiationResult {
                 if (semaphore) {
                     resourceProvider->priv().gpu()->waitSemaphore(semaphore);
@@ -197,8 +180,8 @@
                     // ever see the original texture, so this should be safe.
                     // We make the texture uncacheable so that the release proc is called ASAP.
                     tex = resourceProvider->wrapBackendTexture(
-                            backendTexture, grColorType, kBorrow_GrWrapOwnership,
-                            GrWrapCacheable::kNo, kRead_GrIOType);
+                            backendTexture, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo,
+                            kRead_GrIOType);
                     if (!tex) {
                         return {};
                     }
@@ -209,8 +192,9 @@
                 // unrelated to the whatever SkImage key may be assigned to the proxy.
                 return {std::move(tex), GrSurfaceProxy::LazyInstantiationKeyMode::kUnsynced};
             },
-            backendFormat, desc, GrRenderable::kNo, fSurfaceOrigin, mipMapped,
+            format, desc, GrRenderable::kNo, fSurfaceOrigin, mipMapped,
             GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact, SkBudgeted::kNo);
+
     if (!proxy) {
         return nullptr;
     }