Cleanup of code that converts from GPU-backed resources to SkImageInfo

Functions like GrMakeInfoFromTexture encouraged incorrect code to be
written. Similarly, the ability to construct an info from any GrSurface
was never going to be correct. Luckily, the only client of that had all
of the correct parameters much higher on the stack (and dictated or
replaced most of the properties of the returned info anyway).

With this, I can finally remove the color space as an output of the
pixel config -> color type conversion, which was never going to be
correct.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2173513002

Review-Url: https://codereview.chromium.org/2173513002
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index fa697cd..c331a29 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -43,6 +43,14 @@
     }
 }
 
+SkImageInfo SkImage_Gpu::onImageInfo() const {
+    SkColorType ct;
+    if (!GrPixelConfigToColorType(fTexture->config(), &ct)) {
+        ct = kUnknown_SkColorType;
+    }
+    return SkImageInfo::Make(fTexture->width(), fTexture->height(), ct, fAlphaType, fColorSpace);
+}
+
 static SkImageInfo make_info(int w, int h, bool isOpaque, sk_sp<SkColorSpace> colorSpace) {
     return SkImageInfo::MakeN32(w, h, isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType,
                                 std::move(colorSpace));
@@ -316,17 +324,10 @@
 }
 
 sk_sp<SkImage> SkImage::makeNonTextureImage() const {
-    GrTexture* texture = as_IB(this)->peekTexture();
-    if (!texture) {
+    if (!this->isTextureBacked()) {
         return sk_ref_sp(const_cast<SkImage*>(this));
     }
-    SkColorType ct;
-    sk_sp<SkColorSpace> cs;
-    if (!GrPixelConfigToColorAndColorSpace(texture->config(), &ct, &cs)) {
-        return nullptr;
-    }
-    SkAlphaType at = this->isOpaque() ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
-    auto info = SkImageInfo::Make(this->width(), this->height(), ct, at, cs);
+    SkImageInfo info = as_IB(this)->onImageInfo();
     size_t rowBytes = info.minRowBytes();
     size_t size = info.getSafeSize(rowBytes);
     auto data = SkData::MakeUninitialized(size);