Rename GrSurfaceContext -> skgpu::SurfaceContext

Almost entirely mechanical.

Bug: skia:11837
Change-Id: I984339097fdeeae2eccb6c1d790d510020511961
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438177
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/core/SkGpuBlurUtils.cpp b/src/core/SkGpuBlurUtils.cpp
index 98785c7..81800c9 100644
--- a/src/core/SkGpuBlurUtils.cpp
+++ b/src/core/SkGpuBlurUtils.cpp
@@ -302,7 +302,7 @@
 // image, so there's no need to account for a proxy offset from the original input.
 static std::unique_ptr<skgpu::v1::SurfaceDrawContext> reexpand(
         GrRecordingContext* rContext,
-        std::unique_ptr<GrSurfaceContext> src,
+        std::unique_ptr<skgpu::SurfaceContext> src,
         const SkRect& srcBounds,
         SkISize dstSize,
         sk_sp<SkColorSpace> colorSpace,
diff --git a/src/gpu/GrDirectContext.cpp b/src/gpu/GrDirectContext.cpp
index 9ab0c67..80eca7c 100644
--- a/src/gpu/GrDirectContext.cpp
+++ b/src/gpu/GrDirectContext.cpp
@@ -20,7 +20,7 @@
 #include "src/gpu/GrGpu.h"
 #include "src/gpu/GrResourceProvider.h"
 #include "src/gpu/GrShaderUtils.h"
-#include "src/gpu/GrSurfaceContext.h"
+#include "src/gpu/SurfaceContext.h"
 #include "src/gpu/effects/GrSkSLFP.h"
 #include "src/gpu/gl/GrGLGpu.h"
 #include "src/gpu/mock/GrMockGpu.h"
@@ -523,7 +523,7 @@
 
     GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(format, ct);
     GrSurfaceProxyView view(std::move(proxy), textureOrigin, swizzle);
-    GrSurfaceContext surfaceContext(context, std::move(view), src[0].info().colorInfo());
+    skgpu::SurfaceContext surfaceContext(context, std::move(view), src[0].info().colorInfo());
     SkAutoSTArray<15, GrCPixmap> tmpSrc(numLevels);
     for (int i = 0; i < numLevels; ++i) {
         tmpSrc[i] = src[i];
diff --git a/src/gpu/GrDirectContextPriv.cpp b/src/gpu/GrDirectContextPriv.cpp
index 2bfef8a..c992bc6 100644
--- a/src/gpu/GrDirectContextPriv.cpp
+++ b/src/gpu/GrDirectContextPriv.cpp
@@ -15,10 +15,10 @@
 #include "src/gpu/GrGpu.h"
 #include "src/gpu/GrMemoryPool.h"
 #include "src/gpu/GrRecordingContextPriv.h"
-#include "src/gpu/GrSurfaceContext.h"
 #include "src/gpu/GrTexture.h"
 #include "src/gpu/GrThreadSafePipelineBuilder.h"
 #include "src/gpu/SkGr.h"
+#include "src/gpu/SurfaceContext.h"
 #include "src/gpu/SurfaceFillContext.h"
 #include "src/gpu/effects/GrSkSLFP.h"
 #include "src/gpu/effects/GrTextureEffect.h"
diff --git a/src/gpu/GrDrawingManager.h b/src/gpu/GrDrawingManager.h
index e5b487c..b727899 100644
--- a/src/gpu/GrDrawingManager.h
+++ b/src/gpu/GrDrawingManager.h
@@ -37,7 +37,6 @@
 class GrResourceAllocator;
 class GrSemaphore;
 class GrSoftwarePathRenderer;
-class GrSurfaceContext;
 class GrSurfaceProxyView;
 class GrTessellationPathRenderer;
 class GrTextureResolveRenderTask;
diff --git a/src/gpu/GrRecordingContext.cpp b/src/gpu/GrRecordingContext.cpp
index 1f161c4..310797f 100644
--- a/src/gpu/GrRecordingContext.cpp
+++ b/src/gpu/GrRecordingContext.cpp
@@ -17,8 +17,8 @@
 #include "src/gpu/GrProgramDesc.h"
 #include "src/gpu/GrProxyProvider.h"
 #include "src/gpu/GrRecordingContextPriv.h"
-#include "src/gpu/GrSurfaceContext.h"
 #include "src/gpu/SkGr.h"
+#include "src/gpu/SurfaceContext.h"
 #include "src/gpu/effects/GrSkSLFP.h"
 #include "src/gpu/text/GrTextBlob.h"
 #include "src/gpu/text/GrTextBlobCache.h"
diff --git a/src/gpu/GrRecordingContextPriv.cpp b/src/gpu/GrRecordingContextPriv.cpp
index 4c61390..1a3e3fb 100644
--- a/src/gpu/GrRecordingContextPriv.cpp
+++ b/src/gpu/GrRecordingContextPriv.cpp
@@ -93,8 +93,8 @@
             this->options().fGlyphsAsPathsFontSize};
 }
 
-std::unique_ptr<GrSurfaceContext> GrRecordingContextPriv::makeSC(GrSurfaceProxyView readView,
-                                                                 const GrColorInfo& info) {
+std::unique_ptr<skgpu::SurfaceContext> GrRecordingContextPriv::makeSC(GrSurfaceProxyView readView,
+                                                                      const GrColorInfo& info) {
 #if GR_TEST_UTILS
     if (this->options().fUseSkGpuV2 == GrContextOptions::Enable::kYes) {
 #if SK_GPU_V2
@@ -105,7 +105,7 @@
     {
 #if SK_GPU_V1
         // It is probably not necessary to check if the context is abandoned here since uses of the
-        // GrSurfaceContext which need the context will mostly likely fail later on w/o an issue.
+        // SurfaceContext which need the context will mostly likely fail later on w/o an issue.
         // However having this hear adds some reassurance in case there is a path doesn't handle an
         // abandoned context correctly. It also lets us early out of some extra work.
         if (this->context()->abandoned()) {
@@ -114,7 +114,7 @@
         GrSurfaceProxy* proxy = readView.proxy();
         SkASSERT(proxy && proxy->asTextureProxy());
 
-        std::unique_ptr<GrSurfaceContext> sc;
+        std::unique_ptr<skgpu::SurfaceContext> sc;
         if (proxy->asRenderTargetProxy()) {
             // Will we ever want a swizzle that is not the default write swizzle for the format and
             // colorType here? If so we will need to manually pass that in.
@@ -139,7 +139,9 @@
                                                                      info);
             }
         } else {
-            sc = std::make_unique<GrSurfaceContext>(this->context(), std::move(readView), info);
+            sc = std::make_unique<skgpu::SurfaceContext>(this->context(),
+                                                         std::move(readView),
+                                                         info);
         }
         SkDEBUGCODE(sc->validate();)
         return sc;
diff --git a/src/gpu/GrRecordingContextPriv.h b/src/gpu/GrRecordingContextPriv.h
index 82add47..196e690 100644
--- a/src/gpu/GrRecordingContextPriv.h
+++ b/src/gpu/GrRecordingContextPriv.h
@@ -17,7 +17,10 @@
 class GrImageInfo;
 class GrSwizzle;
 class SkDeferredDisplayList;
-namespace skgpu { class SurfaceFillContext; }
+namespace skgpu {
+    class SurfaceContext;
+    class SurfaceFillContext;
+}
 
 /** Class that exposes methods on GrRecordingContext that are only intended for use internal to
     Skia. This class is purely a privileged window into GrRecordingContext. It should never have
@@ -126,9 +129,9 @@
                                           skgpu::BaseDevice::InitContents);
 
     // If the passed in GrSurfaceProxy is renderable this will return a SurfaceDrawContext,
-    // otherwise it will return a GrSurfaceContext.
-    std::unique_ptr<GrSurfaceContext> makeSC(GrSurfaceProxyView readView,
-                                             const GrColorInfo&);
+    // otherwise it will return a SurfaceContext.
+    std::unique_ptr<skgpu::SurfaceContext> makeSC(GrSurfaceProxyView readView,
+                                                  const GrColorInfo&);
 
     /**
      * Uses GrImageInfo's color type to pick the default texture format. Will return a
diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp
index 22df7e7..f3c9c63 100644
--- a/src/gpu/GrSWMaskHelper.cpp
+++ b/src/gpu/GrSWMaskHelper.cpp
@@ -12,9 +12,9 @@
 #include "src/gpu/GrCaps.h"
 #include "src/gpu/GrProxyProvider.h"
 #include "src/gpu/GrRecordingContextPriv.h"
-#include "src/gpu/GrSurfaceContext.h"
 #include "src/gpu/GrTextureProxy.h"
 #include "src/gpu/SkGr.h"
+#include "src/gpu/SurfaceContext.h"
 #include "src/gpu/geometry/GrStyledShape.h"
 
 /*
diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp
index b19f527..e4a3e77 100644
--- a/src/gpu/GrSurfaceProxy.cpp
+++ b/src/gpu/GrSurfaceProxy.cpp
@@ -276,16 +276,16 @@
 
     if (src->backendFormat().textureType() != GrTextureType::kExternal) {
         GrImageInfo info(GrColorType::kUnknown, kUnknown_SkAlphaType, nullptr, {width, height});
-        auto dstContext = GrSurfaceContext::Make(context,
-                                                 info,
-                                                 format,
-                                                 fit,
-                                                 origin,
-                                                 GrRenderable::kNo,
-                                                 1,
-                                                 mipMapped,
-                                                 src->isProtected(),
-                                                 budgeted);
+        auto dstContext = skgpu::SurfaceContext::Make(context,
+                                                      info,
+                                                      format,
+                                                      fit,
+                                                      origin,
+                                                      GrRenderable::kNo,
+                                                      1,
+                                                      mipMapped,
+                                                      src->isProtected(),
+                                                      budgeted);
         sk_sp<GrRenderTask> copyTask;
         if (dstContext && (copyTask = dstContext->copy(src, srcRect, dstPoint))) {
             if (outTask) {
diff --git a/src/gpu/GrSurfaceProxy.h b/src/gpu/GrSurfaceProxy.h
index 1d343bc..635ce30 100644
--- a/src/gpu/GrSurfaceProxy.h
+++ b/src/gpu/GrSurfaceProxy.h
@@ -22,7 +22,6 @@
 class GrRenderTargetProxy;
 class GrRenderTask;
 class GrResourceProvider;
-class GrSurfaceContext;
 class GrSurfaceProxyPriv;
 class GrSurfaceProxyView;
 class GrTextureProxy;
diff --git a/src/gpu/GrSurfaceContext.cpp b/src/gpu/SurfaceContext.cpp
similarity index 90%
rename from src/gpu/GrSurfaceContext.cpp
rename to src/gpu/SurfaceContext.cpp
index b884b9e..335a8cc 100644
--- a/src/gpu/GrSurfaceContext.cpp
+++ b/src/gpu/SurfaceContext.cpp
@@ -5,7 +5,7 @@
  * found in the LICENSE file.
  */
 
-#include "src/gpu/GrSurfaceContext.h"
+#include "src/gpu/SurfaceContext.h"
 
 #include <memory>
 
@@ -33,16 +33,18 @@
 #define RETURN_FALSE_IF_ABANDONED   if (this->fContext->abandoned()) { return false;   }
 #define RETURN_NULLPTR_IF_ABANDONED if (this->fContext->abandoned()) { return nullptr; }
 
-std::unique_ptr<GrSurfaceContext> GrSurfaceContext::Make(GrRecordingContext* rContext,
-                                                         const GrImageInfo& info,
-                                                         const GrBackendFormat& format,
-                                                         SkBackingFit fit,
-                                                         GrSurfaceOrigin origin,
-                                                         GrRenderable renderable,
-                                                         int sampleCount,
-                                                         GrMipmapped mipmapped,
-                                                         GrProtected isProtected,
-                                                         SkBudgeted budgeted) {
+namespace skgpu {
+
+std::unique_ptr<SurfaceContext> SurfaceContext::Make(GrRecordingContext* rContext,
+                                                     const GrImageInfo& info,
+                                                     const GrBackendFormat& format,
+                                                     SkBackingFit fit,
+                                                     GrSurfaceOrigin origin,
+                                                     GrRenderable renderable,
+                                                     int sampleCount,
+                                                     GrMipmapped mipmapped,
+                                                     GrProtected isProtected,
+                                                     SkBudgeted budgeted) {
     SkASSERT(rContext);
     SkASSERT(renderable == GrRenderable::kYes || sampleCount == 1);
     if (rContext->abandoned()) {
@@ -70,15 +72,15 @@
     return rContext->priv().makeSC(std::move(view), info.colorInfo());
 }
 
-std::unique_ptr<GrSurfaceContext> GrSurfaceContext::Make(GrRecordingContext* rContext,
-                                                         const GrImageInfo& info,
-                                                         SkBackingFit fit,
-                                                         GrSurfaceOrigin origin,
-                                                         GrRenderable renderable,
-                                                         int sampleCount,
-                                                         GrMipmapped mipmapped,
-                                                         GrProtected isProtected,
-                                                         SkBudgeted budgeted) {
+std::unique_ptr<SurfaceContext> SurfaceContext::Make(GrRecordingContext* rContext,
+                                                     const GrImageInfo& info,
+                                                     SkBackingFit fit,
+                                                     GrSurfaceOrigin origin,
+                                                     GrRenderable renderable,
+                                                     int sampleCount,
+                                                     GrMipmapped mipmapped,
+                                                     GrProtected isProtected,
+                                                     SkBudgeted budgeted) {
     GrBackendFormat format = rContext->priv().caps()->getDefaultBackendFormat(info.colorType(),
                                                                               renderable);
     return Make(rContext,
@@ -93,25 +95,25 @@
                 budgeted);
 }
 
-GrSurfaceContext::GrSurfaceContext(GrRecordingContext* context,
-                                   GrSurfaceProxyView readView,
-                                   const GrColorInfo& info)
+SurfaceContext::SurfaceContext(GrRecordingContext* context,
+                               GrSurfaceProxyView readView,
+                               const GrColorInfo& info)
         : fContext(context), fReadView(std::move(readView)), fColorInfo(info) {
     SkASSERT(!context->abandoned());
 }
 
-const GrCaps* GrSurfaceContext::caps() const { return fContext->priv().caps(); }
+const GrCaps* SurfaceContext::caps() const { return fContext->priv().caps(); }
 
-GrDrawingManager* GrSurfaceContext::drawingManager() {
+GrDrawingManager* SurfaceContext::drawingManager() {
     return fContext->priv().drawingManager();
 }
 
-const GrDrawingManager* GrSurfaceContext::drawingManager() const {
+const GrDrawingManager* SurfaceContext::drawingManager() const {
     return fContext->priv().drawingManager();
 }
 
 #ifdef SK_DEBUG
-GrSingleOwner* GrSurfaceContext::singleOwner() const { return fContext->priv().singleOwner(); }
+GrSingleOwner* SurfaceContext::singleOwner() const { return fContext->priv().singleOwner(); }
 #endif
 
 static bool alpha_types_compatible(SkAlphaType srcAlphaType, SkAlphaType dstAlphaType) {
@@ -119,11 +121,11 @@
     return (srcAlphaType == kUnknown_SkAlphaType) == (dstAlphaType == kUnknown_SkAlphaType);
 }
 
-bool GrSurfaceContext::readPixels(GrDirectContext* dContext, GrPixmap dst, SkIPoint pt) {
+bool SurfaceContext::readPixels(GrDirectContext* dContext, GrPixmap dst, SkIPoint pt) {
     ASSERT_SINGLE_OWNER
     RETURN_FALSE_IF_ABANDONED
     SkDEBUGCODE(this->validate();)
-    GR_CREATE_TRACE_MARKER_CONTEXT("GrSurfaceContext", "readPixels", fContext);
+    GR_CREATE_TRACE_MARKER_CONTEXT("SurfaceContext", "readPixels", fContext);
 
     if (!fContext->priv().matches(dContext)) {
         return false;
@@ -191,7 +193,7 @@
     }
 
     if (readFlag == GrCaps::SurfaceReadPixelsSupport::kCopyToTexture2D || canvas2DFastPath) {
-        std::unique_ptr<GrSurfaceContext> tempCtx;
+        std::unique_ptr<SurfaceContext> tempCtx;
         if (this->asTextureProxy()) {
             GrColorType colorType = (canvas2DFastPath || srcIsCompressed)
                                             ? GrColorType::kRGBA_8888
@@ -312,9 +314,9 @@
     return true;
 }
 
-bool GrSurfaceContext::writePixels(GrDirectContext* dContext,
-                                   GrCPixmap src,
-                                   SkIPoint dstPt) {
+bool SurfaceContext::writePixels(GrDirectContext* dContext,
+                                 GrCPixmap src,
+                                 SkIPoint dstPt) {
     ASSERT_SINGLE_OWNER
     RETURN_FALSE_IF_ABANDONED
     SkDEBUGCODE(this->validate();)
@@ -329,9 +331,9 @@
     return this->internalWritePixels(dContext, &src, 1, dstPt);
 }
 
-bool GrSurfaceContext::writePixels(GrDirectContext* dContext,
-                                   const GrCPixmap src[],
-                                   int numLevels) {
+bool SurfaceContext::writePixels(GrDirectContext* dContext,
+                                 const GrCPixmap src[],
+                                 int numLevels) {
     ASSERT_SINGLE_OWNER
     RETURN_FALSE_IF_ABANDONED
     SkDEBUGCODE(this->validate();)
@@ -369,11 +371,11 @@
     return this->internalWritePixels(dContext, src, numLevels, {0, 0});
 }
 
-bool GrSurfaceContext::internalWritePixels(GrDirectContext* dContext,
-                                           const GrCPixmap src[],
-                                           int numLevels,
-                                           SkIPoint pt) {
-    GR_CREATE_TRACE_MARKER_CONTEXT("GrSurfaceContext", "internalWritePixels", fContext);
+bool SurfaceContext::internalWritePixels(GrDirectContext* dContext,
+                                         const GrCPixmap src[],
+                                         int numLevels,
+                                         SkIPoint pt) {
+    GR_CREATE_TRACE_MARKER_CONTEXT("SurfaceContext", "internalWritePixels", fContext);
 
     SkASSERT(numLevels >= 1);
     SkASSERT(src);
@@ -475,7 +477,7 @@
             return false;
         }
         GrSurfaceProxyView tempView(tempProxy, tempOrigin, tempReadSwizzle);
-        GrSurfaceContext tempCtx(dContext, tempView, tempColorInfo);
+        SurfaceContext tempCtx(dContext, tempView, tempColorInfo);
 
         // In the fast path we always write the srcData to the temp context as though it were RGBA.
         // When the data is really BGRA the write will cause the R and B channels to be swapped in
@@ -586,13 +588,13 @@
     return true;
 }
 
-void GrSurfaceContext::asyncRescaleAndReadPixels(GrDirectContext* dContext,
-                                                 const SkImageInfo& info,
-                                                 const SkIRect& srcRect,
-                                                 RescaleGamma rescaleGamma,
-                                                 RescaleMode rescaleMode,
-                                                 ReadPixelsCallback callback,
-                                                 ReadPixelsContext callbackContext) {
+void SurfaceContext::asyncRescaleAndReadPixels(GrDirectContext* dContext,
+                                               const SkImageInfo& info,
+                                               const SkIRect& srcRect,
+                                               RescaleGamma rescaleGamma,
+                                               RescaleMode rescaleMode,
+                                               ReadPixelsCallback callback,
+                                               ReadPixelsContext callbackContext) {
     if (!dContext) {
         callback(callbackContext, nullptr);
         return;
@@ -661,7 +663,7 @@
                                    callbackContext);
 }
 
-class GrSurfaceContext::AsyncReadResult : public SkImage::AsyncReadResult {
+class SurfaceContext::AsyncReadResult : public SkImage::AsyncReadResult {
 public:
     AsyncReadResult(GrDirectContext::DirectContextID intendedRecipient)
         : fIntendedRecipient(intendedRecipient) {
@@ -756,11 +758,11 @@
     GrDirectContext::DirectContextID fIntendedRecipient;
 };
 
-void GrSurfaceContext::asyncReadPixels(GrDirectContext* dContext,
-                                       const SkIRect& rect,
-                                       SkColorType colorType,
-                                       ReadPixelsCallback callback,
-                                       ReadPixelsContext callbackContext) {
+void SurfaceContext::asyncReadPixels(GrDirectContext* dContext,
+                                     const SkIRect& rect,
+                                     SkColorType colorType,
+                                     ReadPixelsCallback callback,
+                                     ReadPixelsContext callbackContext) {
     SkASSERT(rect.fLeft >= 0 && rect.fRight <= this->width());
     SkASSERT(rect.fTop >= 0 && rect.fBottom <= this->height());
 
@@ -832,15 +834,15 @@
                                   flushInfo);
 }
 
-void GrSurfaceContext::asyncRescaleAndReadPixelsYUV420(GrDirectContext* dContext,
-                                                       SkYUVColorSpace yuvColorSpace,
-                                                       sk_sp<SkColorSpace> dstColorSpace,
-                                                       const SkIRect& srcRect,
-                                                       SkISize dstSize,
-                                                       RescaleGamma rescaleGamma,
-                                                       RescaleMode rescaleMode,
-                                                       ReadPixelsCallback callback,
-                                                       ReadPixelsContext callbackContext) {
+void SurfaceContext::asyncRescaleAndReadPixelsYUV420(GrDirectContext* dContext,
+                                                     SkYUVColorSpace yuvColorSpace,
+                                                     sk_sp<SkColorSpace> dstColorSpace,
+                                                     const SkIRect& srcRect,
+                                                     SkISize dstSize,
+                                                     RescaleGamma rescaleGamma,
+                                                     RescaleMode rescaleMode,
+                                                     ReadPixelsCallback callback,
+                                                     ReadPixelsContext callbackContext) {
     SkASSERT(srcRect.fLeft >= 0 && srcRect.fRight <= this->width());
     SkASSERT(srcRect.fTop >= 0 && srcRect.fBottom <= this->height());
     SkASSERT(!dstSize.isZero());
@@ -1078,13 +1080,13 @@
                                   flushInfo);
 }
 
-sk_sp<GrRenderTask> GrSurfaceContext::copy(sk_sp<GrSurfaceProxy> src,
-                                           SkIRect srcRect,
-                                           SkIPoint dstPoint) {
+sk_sp<GrRenderTask> SurfaceContext::copy(sk_sp<GrSurfaceProxy> src,
+                                         SkIRect srcRect,
+                                         SkIPoint dstPoint) {
     ASSERT_SINGLE_OWNER
     RETURN_NULLPTR_IF_ABANDONED
     SkDEBUGCODE(this->validate();)
-    GR_CREATE_TRACE_MARKER_CONTEXT("GrSurfaceContext", "copy", fContext);
+    GR_CREATE_TRACE_MARKER_CONTEXT("SurfaceContext", "copy", fContext);
 
     const GrCaps* caps = fContext->priv().caps();
 
@@ -1106,11 +1108,11 @@
                                                      this->origin());
 }
 
-std::unique_ptr<skgpu::SurfaceFillContext> GrSurfaceContext::rescale(const GrImageInfo& info,
-                                                                     GrSurfaceOrigin origin,
-                                                                     SkIRect srcRect,
-                                                                     RescaleGamma rescaleGamma,
-                                                                     RescaleMode rescaleMode) {
+std::unique_ptr<skgpu::SurfaceFillContext> SurfaceContext::rescale(const GrImageInfo& info,
+                                                                   GrSurfaceOrigin origin,
+                                                                   SkIRect srcRect,
+                                                                   RescaleGamma rescaleGamma,
+                                                                   RescaleMode rescaleMode) {
     auto sfc = fContext->priv().makeSFCWithFallback(info,
                                                     SkBackingFit::kExact,
                                                     1,
@@ -1127,11 +1129,11 @@
     return sfc;
 }
 
-bool GrSurfaceContext::rescaleInto(skgpu::SurfaceFillContext* dst,
-                                   SkIRect dstRect,
-                                   SkIRect srcRect,
-                                   RescaleGamma rescaleGamma,
-                                   RescaleMode rescaleMode) {
+bool SurfaceContext::rescaleInto(skgpu::SurfaceFillContext* dst,
+                                 SkIRect dstRect,
+                                 SkIRect srcRect,
+                                 RescaleGamma rescaleGamma,
+                                 RescaleMode rescaleMode) {
     SkASSERT(dst);
     if (!SkIRect::MakeSize(dst->dimensions()).contains((dstRect))) {
         return false;
@@ -1277,8 +1279,8 @@
     return true;
 }
 
-GrSurfaceContext::PixelTransferResult GrSurfaceContext::transferPixels(GrColorType dstCT,
-                                                                       const SkIRect& rect) {
+SurfaceContext::PixelTransferResult SurfaceContext::transferPixels(GrColorType dstCT,
+                                                                   const SkIRect& rect) {
     SkASSERT(rect.fLeft >= 0 && rect.fRight <= this->width());
     SkASSERT(rect.fTop >= 0 && rect.fBottom <= this->height());
     auto direct = fContext->asDirectContext();
@@ -1343,7 +1345,7 @@
 }
 
 #ifdef SK_DEBUG
-void GrSurfaceContext::validate() const {
+void SurfaceContext::validate() const {
     SkASSERT(fReadView.proxy());
     fReadView.proxy()->validate(fContext);
     if (this->colorInfo().colorType() != GrColorType::kUnknown) {
@@ -1353,3 +1355,5 @@
     this->onValidate();
 }
 #endif
+
+} // namespace skgpu
diff --git a/src/gpu/GrSurfaceContext.h b/src/gpu/SurfaceContext.h
similarity index 79%
rename from src/gpu/GrSurfaceContext.h
rename to src/gpu/SurfaceContext.h
index 0a8c7c3..fc73e57 100644
--- a/src/gpu/GrSurfaceContext.h
+++ b/src/gpu/SurfaceContext.h
@@ -5,8 +5,8 @@
  * found in the LICENSE file.
  */
 
-#ifndef GrSurfaceContext_DEFINED
-#define GrSurfaceContext_DEFINED
+#ifndef SurfaceContext_DEFINED
+#define SurfaceContext_DEFINED
 
 #include "include/core/SkImage.h"
 #include "include/core/SkRect.h"
@@ -26,46 +26,60 @@
 class GrRenderTargetProxy;
 class GrSingleOwner;
 class GrSurface;
-namespace skgpu { class SurfaceFillContext; }
 class GrSurfaceProxy;
 class GrTextureProxy;
 struct SkIPoint;
 struct SkIRect;
 
+namespace skgpu {
+
+class SurfaceFillContext;
+
 /**
  * A helper object to orchestrate commands for a particular surface
+ *
+ *            SurfaceContext
+ *                   |
+ *          SurfaceFillContext
+ *           /               \
+ *     v1::SFC               v2::SFC
+ *        |                     |
+ *        |                     |
+ *        |                     |
+ *     v1::SDC               v2::SDC
+ *
  */
-class GrSurfaceContext {
+class SurfaceContext {
 public:
-    // Makes either a GrSurfaceContext, GrFillDrawContext, or a SurfaceDrawContext, depending on
+    // Makes either a SurfaceContext, SurfaceFillContext, or a SurfaceDrawContext, depending on
     // GrRenderable and the GrImageInfo.
-    static std::unique_ptr<GrSurfaceContext> Make(GrRecordingContext*,
-                                                  const GrImageInfo&,
-                                                  const GrBackendFormat&,
-                                                  SkBackingFit = SkBackingFit::kExact,
-                                                  GrSurfaceOrigin = kTopLeft_GrSurfaceOrigin,
-                                                  GrRenderable = GrRenderable::kNo,
-                                                  int renderTargetSampleCnt = 1,
-                                                  GrMipmapped = GrMipmapped::kNo,
-                                                  GrProtected = GrProtected::kNo,
-                                                  SkBudgeted = SkBudgeted::kYes);
+    static std::unique_ptr<SurfaceContext> Make(GrRecordingContext*,
+                                                const GrImageInfo&,
+                                                const GrBackendFormat&,
+                                                SkBackingFit = SkBackingFit::kExact,
+                                                GrSurfaceOrigin = kTopLeft_GrSurfaceOrigin,
+                                                GrRenderable = GrRenderable::kNo,
+                                                int renderTargetSampleCnt = 1,
+                                                GrMipmapped = GrMipmapped::kNo,
+                                                GrProtected = GrProtected::kNo,
+                                                SkBudgeted = SkBudgeted::kYes);
 
     // Same as the above but chooses the texture format using the default format for the color type.
-    static std::unique_ptr<GrSurfaceContext> Make(GrRecordingContext*,
-                                                  const GrImageInfo&,
-                                                  SkBackingFit = SkBackingFit::kExact,
-                                                  GrSurfaceOrigin = kTopLeft_GrSurfaceOrigin,
-                                                  GrRenderable = GrRenderable::kNo,
-                                                  int renderTargetSampleCnt = 1,
-                                                  GrMipmapped = GrMipmapped::kNo,
-                                                  GrProtected = GrProtected::kNo,
-                                                  SkBudgeted = SkBudgeted::kYes);
+    static std::unique_ptr<SurfaceContext> Make(GrRecordingContext*,
+                                                const GrImageInfo&,
+                                                SkBackingFit = SkBackingFit::kExact,
+                                                GrSurfaceOrigin = kTopLeft_GrSurfaceOrigin,
+                                                GrRenderable = GrRenderable::kNo,
+                                                int renderTargetSampleCnt = 1,
+                                                GrMipmapped = GrMipmapped::kNo,
+                                                GrProtected = GrProtected::kNo,
+                                                SkBudgeted = SkBudgeted::kYes);
 
-    // If it is known that the GrSurfaceProxy is not renderable, you can directly call the the ctor
-    // here to make a GrSurfaceContext on the stack.
-    GrSurfaceContext(GrRecordingContext*, GrSurfaceProxyView readView, const GrColorInfo&);
+    // If it is known that the GrSurfaceProxy is not renderable, you can directly call the ctor
+    // here to make a SurfaceContext on the stack.
+    SurfaceContext(GrRecordingContext*, GrSurfaceProxyView readView, const GrColorInfo&);
 
-    virtual ~GrSurfaceContext() = default;
+    virtual ~SurfaceContext() = default;
 
     GrRecordingContext* recordingContext() const { return fContext; }
 
@@ -157,7 +171,7 @@
         return fReadView.asRenderTargetProxyRef();
     }
 
-    virtual skgpu::SurfaceFillContext* asFillContext() { return nullptr; }
+    virtual SurfaceFillContext* asFillContext() { return nullptr; }
 
     /**
      * Rescales the contents of srcRect. The gamma in which the rescaling occurs is controlled by
@@ -176,7 +190,7 @@
      * Like the above but allows the caller ot specify a destination fill context and
      * rect within that context. The dst rect must be contained by the dst or this will fail.
      */
-    bool rescaleInto(skgpu::SurfaceFillContext* dst,
+    bool rescaleInto(SurfaceFillContext* dst,
                      SkIRect dstRect,
                      SkIRect srcRect,
                      SkImage::RescaleGamma,
@@ -227,8 +241,8 @@
                          ReadPixelsContext);
 
 private:
-    friend class GrRecordingContextPriv; // for validate
-    friend class GrSurfaceProxy; // for copy
+    friend class ::GrRecordingContextPriv; // for validate
+    friend class ::GrSurfaceProxy; // for copy
 
     SkDEBUGCODE(virtual void onValidate() const {})
 
@@ -261,4 +275,6 @@
     using INHERITED = SkRefCnt;
 };
 
-#endif
+} // namespace skgpu
+
+#endif // SurfaceContext_DEFINED
diff --git a/src/gpu/SurfaceFillContext.h b/src/gpu/SurfaceFillContext.h
index a24c8de..65bfca1 100644
--- a/src/gpu/SurfaceFillContext.h
+++ b/src/gpu/SurfaceFillContext.h
@@ -8,11 +8,11 @@
 #ifndef SurfaceFillContext_DEFINED
 #define SurfaceFillContext_DEFINED
 
-#include "src/gpu/GrSurfaceContext.h"
+#include "src/gpu/SurfaceContext.h"
 
 namespace skgpu {
 
-class SurfaceFillContext : public GrSurfaceContext {
+class SurfaceFillContext : public SurfaceContext {
 public:
 
     SurfaceFillContext* asFillContext() override { return this; }
@@ -103,10 +103,10 @@
 
 protected:
     SurfaceFillContext(GrRecordingContext* rContext,
-                            GrSurfaceProxyView readView,
-                            GrSurfaceProxyView writeView,
-                            const GrColorInfo& colorInfo)
-            : GrSurfaceContext(rContext, std::move(readView), colorInfo)
+                       GrSurfaceProxyView readView,
+                       GrSurfaceProxyView writeView,
+                       const GrColorInfo& colorInfo)
+            : SurfaceContext(rContext, std::move(readView), colorInfo)
             , fWriteView(std::move(writeView)) {
         SkASSERT(this->asSurfaceProxy() == fWriteView.proxy());
         SkASSERT(this->origin() == fWriteView.origin());
@@ -125,7 +125,7 @@
                                std::array<float, 4> color,
                                bool upgradePartialToFull = false) = 0;
 
-    using INHERITED = GrSurfaceContext;
+    using INHERITED = SurfaceContext;
 };
 
 template<>
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index b9e4560..809823b 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -4223,7 +4223,7 @@
         shaderCaps->fUseNodePools = false;
     }
 
-    // skbug.com/11204. Avoid recursion issue in GrSurfaceContext::writePixels.
+    // skbug.com/11204. Avoid recursion issue in SurfaceContext::writePixels.
     if (fDisallowTexSubImageForUnormConfigTexturesEverBoundToFBO) {
         fReuseScratchTextures = false;
     }
diff --git a/src/gpu/text/GrAtlasManager.cpp b/src/gpu/text/GrAtlasManager.cpp
index 5206712..70a7610 100644
--- a/src/gpu/text/GrAtlasManager.cpp
+++ b/src/gpu/text/GrAtlasManager.cpp
@@ -208,9 +208,9 @@
 #ifdef SK_DEBUG
 #include "include/gpu/GrDirectContext.h"
 #include "src/gpu/GrDirectContextPriv.h"
-#include "src/gpu/GrSurfaceContext.h"
 #include "src/gpu/GrSurfaceProxy.h"
 #include "src/gpu/GrTextureProxy.h"
+#include "src/gpu/SurfaceContext.h"
 
 #include "include/core/SkBitmap.h"
 #include "include/core/SkImageEncoder.h"
diff --git a/src/gpu/text/GrTextBlob.cpp b/src/gpu/text/GrTextBlob.cpp
index 362e18a..b4c5230 100644
--- a/src/gpu/text/GrTextBlob.cpp
+++ b/src/gpu/text/GrTextBlob.cpp
@@ -30,7 +30,7 @@
 #if SK_GPU_V1
 #include "src/gpu/v1/SurfaceDrawContext_v1.h"
 #else
-#include "src/gpu/GrSurfaceContext.h"
+#include "src/gpu/SurfaceContext.h"
 #endif
 
 namespace {
@@ -78,7 +78,7 @@
     SkUNREACHABLE;
 }
 
-SkPMColor4f calculate_colors(GrSurfaceContext* sc,
+SkPMColor4f calculate_colors(skgpu::SurfaceContext* sc,
                              const SkPaint& paint,
                              const SkMatrixProvider& matrix,
                              GrMaskFormat grMaskFormat,
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index d4f6073..9468369 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -761,7 +761,7 @@
         return nullptr;
     }
 
-    GrSurfaceContext surfaceContext(
+    skgpu::SurfaceContext surfaceContext(
             dContext, std::move(framebufferView),image->imageInfo().colorInfo());
 
     surfaceContext.writePixels(dContext, pixmap, {0, 0});
diff --git a/src/image/SkImage_GpuBase.cpp b/src/image/SkImage_GpuBase.cpp
index b10e57f..f79caf9 100644
--- a/src/image/SkImage_GpuBase.cpp
+++ b/src/image/SkImage_GpuBase.cpp
@@ -20,9 +20,9 @@
 #include "src/gpu/GrProxyProvider.h"
 #include "src/gpu/GrRecordingContextPriv.h"
 #include "src/gpu/GrResourceProvider.h"
-#include "src/gpu/GrSurfaceContext.h"
 #include "src/gpu/GrTexture.h"
 #include "src/gpu/GrYUVATextureProxies.h"
+#include "src/gpu/SurfaceContext.h"
 #include "src/gpu/effects/GrYUVtoRGBEffect.h"
 #include "src/image/SkImage_Gpu.h"
 #include "src/image/SkReadPixelsRec.h"