Retract the SDC from GMs where possible (take 2)
In the future, the SDC won't be return by SkCanvas/SkDevices and gms/tests that rely on it won't be run. These GMs don't actually require the SDC.
There is also some opportunistic renaming going on.
TBR=michaelludwig@google.com
Change-Id: I15cbaf69269892fbbf229c0263b567425049c3f0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/415167
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/gm/textblobuseaftergpufree.cpp b/gm/textblobuseaftergpufree.cpp
index c3745cc..c85928c 100644
--- a/gm/textblobuseaftergpufree.cpp
+++ b/gm/textblobuseaftergpufree.cpp
@@ -24,7 +24,7 @@
// This tests that we correctly regenerate textblobs after freeing all gpu resources crbug/491350
namespace skiagm {
-class TextBlobUseAfterGpuFree : public GpuGM {
+class TextBlobUseAfterGpuFree : public GM {
public:
TextBlobUseAfterGpuFree() { }
@@ -37,7 +37,9 @@
return SkISize::Make(kWidth, kHeight);
}
- void onDraw(GrRecordingContext* context, GrSurfaceDrawContext*, SkCanvas* canvas) override {
+ void onDraw(SkCanvas* canvas) override {
+ auto dContext = GrAsDirectContext(canvas->recordingContext());
+
const char text[] = "Hamburgefons";
SkFont font(ToolUtils::create_portable_typeface(), 20);
@@ -51,8 +53,8 @@
canvas->drawTextBlob(blob, 20, 60, SkPaint());
// This text should look fine
- if (auto direct = context->asDirectContext()) {
- direct->freeGpuResources();
+ if (dContext) {
+ dContext->freeGpuResources();
}
canvas->drawTextBlob(blob, 20, 160, SkPaint());
}