Remove SkCanvas::getGrContext calls from samplecode

More busywork so we can deprecate getGrContext.

Change-Id: I8479985334881251e6ad814d7855681df716b1da
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301542
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/samplecode/SampleCCPRGeometry.cpp b/samplecode/SampleCCPRGeometry.cpp
index 23061f6..9df119e 100644
--- a/samplecode/SampleCCPRGeometry.cpp
+++ b/samplecode/SampleCCPRGeometry.cpp
@@ -12,6 +12,7 @@
 #include "include/core/SkCanvas.h"
 #include "include/core/SkPaint.h"
 #include "include/core/SkPath.h"
+#include "include/gpu/GrDirectContext.h"
 #include "samplecode/Sample.h"
 #include "src/core/SkRectPriv.h"
 #include "src/gpu/GrContextPriv.h"
@@ -19,6 +20,7 @@
 #include "src/gpu/GrMemoryPool.h"
 #include "src/gpu/GrOnFlushResourceProvider.h"
 #include "src/gpu/GrOpFlushState.h"
+#include "src/gpu/GrRecordingContextPriv.h"
 #include "src/gpu/GrRenderTargetContext.h"
 #include "src/gpu/GrRenderTargetContextPriv.h"
 #include "src/gpu/GrResourceProvider.h"
@@ -187,7 +189,7 @@
     SkString caption;
     if (GrRenderTargetContext* rtc = canvas->internal_private_accessTopLayerRenderTargetContext()) {
         // Render coverage count.
-        GrContext* ctx = canvas->getGrContext();
+        auto ctx = canvas->recordingContext();
         SkASSERT(ctx);
 
         GrOpMemoryPool* pool = ctx->priv().opMemoryPool();
@@ -332,9 +334,9 @@
 void CCPRGeometryView::DrawCoverageCountOp::onExecute(GrOpFlushState* state,
                                                       const SkRect& chainBounds) {
     GrResourceProvider* rp = state->resourceProvider();
-    GrContext* context = state->gpu()->getContext();
+    auto direct = GrAsDirectContext(state->gpu()->getContext());
 #ifdef SK_GL
-    GrGLGpu* glGpu = GrBackendApi::kOpenGL == context->backend()
+    GrGLGpu* glGpu = GrBackendApi::kOpenGL == direct->backend()
                              ? static_cast<GrGLGpu*>(state->gpu())
                              : nullptr;
     if (glGpu) {
@@ -397,7 +399,7 @@
                                        SkIRect::MakeWH(fView->width(), fView->height()), {0, 0});
         GrCCStroker::BatchID batchID = stroker.closeCurrentBatch();
 
-        GrOnFlushResourceProvider onFlushRP(context->priv().drawingManager());
+        GrOnFlushResourceProvider onFlushRP(direct->priv().drawingManager());
         stroker.prepareToDraw(&onFlushRP);
 
         SkIRect ibounds;
@@ -407,7 +409,7 @@
 
 #ifdef SK_GL
     if (glGpu) {
-        context->resetContext(kMisc_GrGLBackendState);
+        direct->resetContext(kMisc_GrGLBackendState);
     }
 #endif
 }