Miscellaneous GrSurfaceProxy-related cleanup

This is pulled out of: https://skia-review.googlesource.com/c/10284/ (Remove GrSurface-derived classes from ops)

Change-Id: I083c0beefe4899b3517d0b0569bb25096809f410
Reviewed-on: https://skia-review.googlesource.com/10483
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/tests/SRGBMipMapTest.cpp b/tests/SRGBMipMapTest.cpp
index 89a47c9..54c68ae 100644
--- a/tests/SRGBMipMapTest.cpp
+++ b/tests/SRGBMipMapTest.cpp
@@ -13,6 +13,7 @@
 #include "GrRenderTargetContext.h"
 #include "GrResourceProvider.h"
 #include "SkCanvas.h"
+#include "SkGr.h"
 #include "SkSurface.h"
 #include "gl/GrGLGpu.h"
 
@@ -45,16 +46,19 @@
     }
 }
 
-void read_and_check_pixels(skiatest::Reporter* reporter, GrTexture* texture, U8CPU expected,
+void read_and_check_pixels(skiatest::Reporter* reporter, GrSurfaceContext* context,
+                           U8CPU expected, const SkImageInfo& dstInfo,
                            U8CPU error, const char* subtestName) {
-    int w = texture->width();
-    int h = texture->height();
+    int w = dstInfo.width();
+    int h = dstInfo.height();
     SkAutoTMalloc<uint32_t> readData(w * h);
     memset(readData.get(), 0, sizeof(uint32_t) * w * h);
-    if (!texture->readPixels(0, 0, w, h, texture->config(), readData.get())) {
+
+    if (!context->readPixels(dstInfo, readData.get(), 0, 0, 0)) {
         ERRORF(reporter, "Could not read pixels for %s.", subtestName);
         return;
     }
+
     for (int j = 0; j < h; ++j) {
         for (int i = 0; i < w; ++i) {
             uint32_t read = readData[j * w + i];
@@ -112,6 +116,12 @@
     const U8CPU expectedLinear = srgb60 / 2;
     const U8CPU error = 10;
 
+    const SkImageInfo iiSRGBA = SkImageInfo::Make(rtS, rtS, kRGBA_8888_SkColorType,
+                                                  kPremul_SkAlphaType,
+                                                  SkColorSpace::MakeSRGB());
+    const SkImageInfo iiRGBA = SkImageInfo::Make(rtS, rtS, kRGBA_8888_SkColorType,
+                                                 kPremul_SkAlphaType);
+
     // Create our test texture
     GrSurfaceDesc desc;
     desc.fFlags = kNone_GrSurfaceFlags;
@@ -142,7 +152,7 @@
     // 1) Draw texture to S32 surface (should generate/use sRGB mips)
     paint.setGammaCorrect(true);
     s32RenderTargetContext->drawRect(noClip, GrPaint(paint), GrAA::kNo, SkMatrix::I(), rect);
-    read_and_check_pixels(reporter, s32RenderTargetContext->asTexture().get(), expectedSRGB, error,
+    read_and_check_pixels(reporter, s32RenderTargetContext.get(), expectedSRGB, iiSRGBA, error,
                           "first render of sRGB");
 
     // 2) Draw texture to L32 surface (should generate/use linear mips)
@@ -161,14 +171,14 @@
     GrGLGpu* glGpu = static_cast<GrGLGpu*>(context->getGpu());
     if (glGpu->glCaps().srgbDecodeDisableSupport() &&
         glGpu->glCaps().srgbDecodeDisableAffectsMipmaps()) {
-        read_and_check_pixels(reporter, l32RenderTargetContext->asTexture().get(), expectedLinear,
+        read_and_check_pixels(reporter, l32RenderTargetContext.get(), expectedLinear, iiRGBA,
                               error, "re-render as linear");
     }
 
     // 3) Go back to sRGB
     paint.setGammaCorrect(true);
     s32RenderTargetContext->drawRect(noClip, std::move(paint), GrAA::kNo, SkMatrix::I(), rect);
-    read_and_check_pixels(reporter, s32RenderTargetContext->asTexture().get(), expectedSRGB, error,
+    read_and_check_pixels(reporter, s32RenderTargetContext.get(), expectedSRGB, iiSRGBA, error,
                           "re-render as sRGB");
 }
 #endif