Add SurfaceProxyView support to Surface/TextureContext.

Bug: skia:9556
Change-Id: I8dfe0a053690acdfdc487cf478e20ea9595d0121
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249880
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrSurfaceContext.h b/src/gpu/GrSurfaceContext.h
index c9de7d0..0bcf6a6 100644
--- a/src/gpu/GrSurfaceContext.h
+++ b/src/gpu/GrSurfaceContext.h
@@ -16,6 +16,7 @@
 #include "src/gpu/GrColorInfo.h"
 #include "src/gpu/GrDataUtils.h"
 #include "src/gpu/GrSurfaceProxy.h"
+#include "src/gpu/GrSurfaceProxyView.h"
 
 class GrAuditTrail;
 class GrDrawingManager;
@@ -38,6 +39,10 @@
     virtual ~GrSurfaceContext() = default;
 
     const GrColorInfo& colorInfo() const { return fColorInfo; }
+    GrSurfaceOrigin origin() const { return fOrigin; }
+    GrSurfaceProxyView textureSurfaceView() {
+        return { this->asSurfaceProxyRef(), fOrigin, fTextureSwizzle };
+    }
 
     // TODO: these two calls would be way cooler if this object had a GrSurfaceProxy pointer
     int width() const { return this->asSurfaceProxy()->width(); }
@@ -104,7 +109,8 @@
 protected:
     friend class GrSurfaceContextPriv;
 
-    GrSurfaceContext(GrRecordingContext*, GrColorType, SkAlphaType, sk_sp<SkColorSpace>);
+    GrSurfaceContext(GrRecordingContext*, GrColorType, SkAlphaType, sk_sp<SkColorSpace>,
+                     GrSurfaceOrigin, GrSwizzle texSwizzle);
 
     GrDrawingManager* drawingManager();
     const GrDrawingManager* drawingManager() const;
@@ -115,6 +121,8 @@
 
     GrRecordingContext* fContext;
 
+    GrSurfaceOrigin fOrigin;
+
     // The rescaling step of asyncRescaleAndReadPixels[YUV420]().
     std::unique_ptr<GrRenderTargetContext> rescale(const SkImageInfo& info, const SkIRect& srcRect,
                                                    SkSurface::RescaleGamma rescaleGamma,
@@ -159,6 +167,7 @@
     }
 
     GrColorInfo fColorInfo;
+    GrSwizzle fTextureSwizzle;
 
     typedef SkRefCnt INHERITED;
 };