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/SampleChineseFling.cpp b/samplecode/SampleChineseFling.cpp
index d16fa06..a9acef6 100644
--- a/samplecode/SampleChineseFling.cpp
+++ b/samplecode/SampleChineseFling.cpp
@@ -17,7 +17,7 @@
#include "include/utils/SkRandom.h"
#if SK_SUPPORT_GPU
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrContextPriv.h"
#endif
@@ -137,21 +137,21 @@
if (fAfterFirstFrame) {
#if SK_SUPPORT_GPU
- GrContext* grContext = canvas->getGrContext();
- if (grContext) {
- sk_sp<SkImage> image = grContext->priv().testingOnly_getFontAtlasImage(
+ auto direct = GrAsDirectContext(canvas->recordingContext());
+ if (direct) {
+ sk_sp<SkImage> image = direct->priv().testingOnly_getFontAtlasImage(
GrMaskFormat::kA8_GrMaskFormat, 0);
canvas->drawImageRect(image,
SkRect::MakeXYWH(10.0f, 10.0f, 512.0f, 512.0), &paint);
- image = grContext->priv().testingOnly_getFontAtlasImage(
+ image = direct->priv().testingOnly_getFontAtlasImage(
GrMaskFormat::kA8_GrMaskFormat, 1);
canvas->drawImageRect(image,
SkRect::MakeXYWH(522.0f, 10.0f, 512.f, 512.0f), &paint);
- image = grContext->priv().testingOnly_getFontAtlasImage(
+ image = direct->priv().testingOnly_getFontAtlasImage(
GrMaskFormat::kA8_GrMaskFormat, 2);
canvas->drawImageRect(image,
SkRect::MakeXYWH(10.0f, 522.0f, 512.0f, 512.0f), &paint);
- image = grContext->priv().testingOnly_getFontAtlasImage(
+ image = direct->priv().testingOnly_getFontAtlasImage(
GrMaskFormat::kA8_GrMaskFormat, 3);
canvas->drawImageRect(image,
SkRect::MakeXYWH(522.0f, 522.0f, 512.0f, 512.0f), &paint);