Rename GrDrawContext to GrRenderTargetContext

This is in preparation for GrTextureContext and GrSurfaceContext

BUG=skia:

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

Change-Id: Ie58c93052e68f3f1f5fe8d15d63760de274a6fbd
Reviewed-on: https://skia-review.googlesource.com/4030
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index dfb2fce..6fb68c6 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -9,7 +9,7 @@
 #include "GrContextPriv.h"
 #include "GrContextOptions.h"
 #include "GrDrawingManager.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
 #include "GrResourceCache.h"
 #include "GrResourceProvider.h"
 #include "GrSoftwarePathRenderer.h"
@@ -208,9 +208,10 @@
 
 void GrContext::TextBlobCacheOverBudgetCB(void* data) {
     SkASSERT(data);
-    // TextBlobs are drawn at the SkGpuDevice level, therefore they cannot rely on GrDrawContext
-    // to perform a necessary flush.  The solution is to move drawText calls to below the GrContext
-    // level, but this is not trivial because they call drawPath on SkGpuDevice.
+    // TextBlobs are drawn at the SkGpuDevice level, therefore they cannot rely on
+    // GrRenderTargetContext to perform a necessary flush.  The solution is to move drawText calls
+    // to below the GrContext level, but this is not trivial because they call drawPath on
+    // SkGpuDevice.
     GrContext* context = reinterpret_cast<GrContext*>(data);
     context->flush();
 }
@@ -348,10 +349,10 @@
             // TODO: Need to decide the semantics of this function for color spaces. Do we support
             // conversion from a passed-in color space? For now, specifying nullptr means that this
             // path will do no conversion, so it will match the behavior of the non-draw path.
-            sk_sp<GrDrawContext> drawContext(this->contextPriv().makeWrappedDrawContext(
-                                                                        sk_ref_sp(renderTarget),
-                                                                        nullptr));
-            if (!drawContext) {
+            sk_sp<GrRenderTargetContext> renderTargetContext(
+                this->contextPriv().makeWrappedRenderTargetContext(sk_ref_sp(renderTarget),
+                                                                   nullptr));
+            if (!renderTargetContext) {
                 return false;
             }
             GrPaint paint;
@@ -359,7 +360,7 @@
             paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
             paint.setAllowSRGBInputs(true);
             SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
-            drawContext->drawRect(GrNoClip(), paint, matrix, rect, nullptr);
+            renderTargetContext->drawRect(GrNoClip(), paint, matrix, rect, nullptr);
 
             if (kFlushWrites_PixelOp & pixelOpsFlags) {
                 this->flushSurfaceWrites(surface);
@@ -440,7 +441,8 @@
         // TODO: Need to decide the semantics of this function for color spaces. Do we support
         // conversion to a passed-in color space? For now, specifying nullptr means that this
         // path will do no conversion, so it will match the behavior of the non-draw path.
-        sk_sp<GrDrawContext> tempDC = this->makeDrawContext(tempDrawInfo.fTempSurfaceFit,
+        sk_sp<GrRenderTargetContext> tempDC = this->makeRenderTargetContext(
+                                                           tempDrawInfo.fTempSurfaceFit,
                                                            tempDrawInfo.fTempSurfaceDesc.fWidth,
                                                            tempDrawInfo.fTempSurfaceDesc.fHeight,
                                                            tempDrawInfo.fTempSurfaceDesc.fConfig,
@@ -544,22 +546,22 @@
                                                         &clippedSrcRect, &clippedDstPoint)) {
             return false;
         }
-        // If we don't have an RT for the dst then we won't have a GrDrawContext to insert the
+        // If we don't have an RT for the dst then we won't have a GrRenderTargetContext to insert
         // the copy surface into. In the future we plan to have a more limited Context type
-        // (GrCopyContext?) that has the subset of GrDrawContext operations that should be
+        // (GrCopyContext?) that has the subset of GrRenderTargetContext operations that should be
         // allowed on textures that aren't render targets.
         // For now we just flush any writes to the src and issue an immediate copy to the dst.
         src->flushWrites();
         return fGpu->copySurface(dst, src, clippedSrcRect, clippedDstPoint);
     }
-    sk_sp<GrDrawContext> drawContext(this->contextPriv().makeWrappedDrawContext(
-                                                                sk_ref_sp(dst->asRenderTarget()),
-                                                                nullptr));
-    if (!drawContext) {
+    sk_sp<GrRenderTargetContext> renderTargetContext(
+        this->contextPriv().makeWrappedRenderTargetContext(sk_ref_sp(dst->asRenderTarget()),
+                                                           nullptr));
+    if (!renderTargetContext) {
         return false;
     }
 
-    if (!drawContext->copySurface(src, srcRect, dstPoint)) {
+    if (!renderTargetContext->copySurface(src, srcRect, dstPoint)) {
         return false;
     }
     return true;
@@ -600,19 +602,20 @@
     return chosenSampleCount <= fGpu->caps()->maxSampleCount() ? chosenSampleCount : 0;
 }
 
-sk_sp<GrDrawContext> GrContextPriv::makeWrappedDrawContext(sk_sp<GrRenderTarget> rt,
-                                                           sk_sp<SkColorSpace> colorSpace,
-                                                           const SkSurfaceProps* surfaceProps) {
+sk_sp<GrRenderTargetContext> GrContextPriv::makeWrappedRenderTargetContext(
+                                                               sk_sp<GrRenderTarget> rt,
+                                                               sk_sp<SkColorSpace> colorSpace,
+                                                               const SkSurfaceProps* surfaceProps) {
     ASSERT_SINGLE_OWNER_PRIV
-    return this->drawingManager()->makeDrawContext(std::move(rt),
-                                                   std::move(colorSpace),
-                                                   surfaceProps);
+    return this->drawingManager()->makeRenderTargetContext(std::move(rt), std::move(colorSpace),
+                                                           surfaceProps);
 }
 
-sk_sp<GrDrawContext> GrContextPriv::makeBackendTextureDrawContext(const GrBackendTextureDesc& desc, 
-                                                                  sk_sp<SkColorSpace> colorSpace,
-                                                                  const SkSurfaceProps* props,
-                                                                  GrWrapOwnership ownership) {
+sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureRenderTargetContext(
+                                                                   const GrBackendTextureDesc& desc, 
+                                                                   sk_sp<SkColorSpace> colorSpace,
+                                                                   const SkSurfaceProps* props,
+                                                                   GrWrapOwnership ownership) {
     ASSERT_SINGLE_OWNER_PRIV
     SkASSERT(desc.fFlags & kRenderTarget_GrBackendTextureFlag);
 
@@ -621,11 +624,11 @@
         return nullptr;
     }
 
-    return this->drawingManager()->makeDrawContext(sk_ref_sp(surface->asRenderTarget()),
-                                                   std::move(colorSpace), props);
+    return this->drawingManager()->makeRenderTargetContext(sk_ref_sp(surface->asRenderTarget()),
+                                                           std::move(colorSpace), props);
 }
 
-sk_sp<GrDrawContext> GrContextPriv::makeBackendRenderTargetDrawContext(
+sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendRenderTargetRenderTargetContext(
                                                 const GrBackendRenderTargetDesc& desc,
                                                 sk_sp<SkColorSpace> colorSpace,
                                                 const SkSurfaceProps* surfaceProps) {
@@ -636,12 +639,11 @@
         return nullptr;
     }
 
-    return this->drawingManager()->makeDrawContext(std::move(rt),
-                                                   std::move(colorSpace),
-                                                   surfaceProps);
+    return this->drawingManager()->makeRenderTargetContext(std::move(rt), std::move(colorSpace),
+                                                           surfaceProps);
 }
 
-sk_sp<GrDrawContext> GrContextPriv::makeBackendTextureAsRenderTargetDrawContext(
+sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureAsRenderTargetRenderTargetContext(
                                                      const GrBackendTextureDesc& desc,
                                                      sk_sp<SkColorSpace> colorSpace,
                                                      const SkSurfaceProps* surfaceProps) {
@@ -653,9 +655,8 @@
         return nullptr;
     }
 
-    return this->drawingManager()->makeDrawContext(sk_ref_sp(surface->asRenderTarget()),
-                                                   std::move(colorSpace),
-                                                   surfaceProps);
+    return this->drawingManager()->makeRenderTargetContext(sk_ref_sp(surface->asRenderTarget()),
+                                                           std::move(colorSpace), surfaceProps);
 }
 
 static inline GrPixelConfig GrPixelConfigFallback(GrPixelConfig config) {
@@ -698,30 +699,31 @@
     GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFallback) == kGrPixelConfigCnt);
 }
 
-sk_sp<GrDrawContext> GrContext::makeDrawContextWithFallback(SkBackingFit fit,
-                                                            int width, int height,
-                                                            GrPixelConfig config,
-                                                            sk_sp<SkColorSpace> colorSpace,
-                                                            int sampleCnt,
-                                                            GrSurfaceOrigin origin,
-                                                            const SkSurfaceProps* surfaceProps,
-                                                            SkBudgeted budgeted) {
+sk_sp<GrRenderTargetContext> GrContext::makeRenderTargetContextWithFallback(
+                                                                 SkBackingFit fit,
+                                                                 int width, int height,
+                                                                 GrPixelConfig config,
+                                                                 sk_sp<SkColorSpace> colorSpace,
+                                                                 int sampleCnt,
+                                                                 GrSurfaceOrigin origin,
+                                                                 const SkSurfaceProps* surfaceProps,
+                                                                 SkBudgeted budgeted) {
     if (!this->caps()->isConfigRenderable(config, sampleCnt > 0)) {
         config = GrPixelConfigFallback(config);
     }
 
-    return this->makeDrawContext(fit, width, height, config, std::move(colorSpace),
-                                 sampleCnt, origin, surfaceProps, budgeted);
+    return this->makeRenderTargetContext(fit, width, height, config, std::move(colorSpace),
+                                         sampleCnt, origin, surfaceProps, budgeted);
 }
 
-sk_sp<GrDrawContext> GrContext::makeDrawContext(SkBackingFit fit,
-                                                int width, int height,
-                                                GrPixelConfig config,
-                                                sk_sp<SkColorSpace> colorSpace,
-                                                int sampleCnt,
-                                                GrSurfaceOrigin origin,
-                                                const SkSurfaceProps* surfaceProps,
-                                                SkBudgeted budgeted) {
+sk_sp<GrRenderTargetContext> GrContext::makeRenderTargetContext(SkBackingFit fit,
+                                                                int width, int height,
+                                                                GrPixelConfig config,
+                                                                sk_sp<SkColorSpace> colorSpace,
+                                                                int sampleCnt,
+                                                                GrSurfaceOrigin origin,
+                                                                const SkSurfaceProps* surfaceProps,
+                                                                SkBudgeted budgeted) {
     if (!this->caps()->isConfigRenderable(config, sampleCnt > 0)) {
         return nullptr;
     }
@@ -744,14 +746,14 @@
         return nullptr;
     }
 
-    sk_sp<GrDrawContext> drawContext(this->contextPriv().makeWrappedDrawContext(
-                                                           sk_ref_sp(tex->asRenderTarget()),
+    sk_sp<GrRenderTargetContext> renderTargetContext(
+        this->contextPriv().makeWrappedRenderTargetContext(sk_ref_sp(tex->asRenderTarget()),
                                                            std::move(colorSpace), surfaceProps));
-    if (!drawContext) {
+    if (!renderTargetContext) {
         return nullptr;
     }
 
-    return drawContext;
+    return renderTargetContext;
 }
 
 bool GrContext::abandoned() const {