Revise GM infrastructure to not rely on GrSurfaceDrawContext
The SDC will soon be V1-only. Remove it from the generic testing infrastructure and require each V1-specific GM to explicitly retrieve it.
Bug: skia:11837
Change-Id: I4c904b7e333333382062bde4b17a1f9f81bee6a9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/430425
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
diff --git a/gm/gm.cpp b/gm/gm.cpp
index 5924129..fdab0d7 100644
--- a/gm/gm.cpp
+++ b/gm/gm.cpp
@@ -144,9 +144,8 @@
SkISize SimpleGpuGM::onISize() { return fSize; }
SkString SimpleGpuGM::onShortName() { return fName; }
-DrawResult SimpleGpuGM::onDraw(GrRecordingContext* rContext, GrSurfaceDrawContext* sdc,
- SkCanvas* canvas, SkString* errorMsg) {
- return fDrawProc(rContext, sdc, canvas, errorMsg);
+DrawResult SimpleGpuGM::onDraw(GrRecordingContext* rContext, SkCanvas* canvas, SkString* errorMsg) {
+ return fDrawProc(rContext, canvas, errorMsg);
}
const char* GM::getName() {
@@ -189,28 +188,26 @@
// need to explicitly declare this, or we get some weird infinite loop llist
template GMRegistry* GMRegistry::gHead;
-DrawResult GpuGM::onDraw(GrRecordingContext* rContext, GrSurfaceDrawContext* sdc, SkCanvas* canvas,
- SkString* errorMsg) {
- this->onDraw(rContext, sdc, canvas);
+DrawResult GpuGM::onDraw(GrRecordingContext* rContext, SkCanvas* canvas, SkString* errorMsg) {
+ this->onDraw(rContext, canvas);
return DrawResult::kOk;
}
-void GpuGM::onDraw(GrRecordingContext*, GrSurfaceDrawContext*, SkCanvas*) {
+void GpuGM::onDraw(GrRecordingContext*, SkCanvas*) {
SK_ABORT("Not implemented.");
}
DrawResult GpuGM::onDraw(SkCanvas* canvas, SkString* errorMsg) {
- auto ctx = canvas->recordingContext();
- GrSurfaceDrawContext* sdc = SkCanvasPriv::TopDeviceSurfaceDrawContext(canvas);
- if (!ctx || !sdc) {
+ auto rContext = canvas->recordingContext();
+ if (!rContext) {
*errorMsg = kErrorMsg_DrawSkippedGpuOnly;
return DrawResult::kSkip;
}
- if (ctx->abandoned()) {
+ if (rContext->abandoned()) {
*errorMsg = "GrContext abandoned.";
return DrawResult::kSkip;
}
- return this->onDraw(ctx, sdc, canvas, errorMsg);
+ return this->onDraw(rContext, canvas, errorMsg);
}
template <typename Fn>