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/preservefillrule.cpp b/gm/preservefillrule.cpp
index fc91a3d..fc69ecb 100644
--- a/gm/preservefillrule.cpp
+++ b/gm/preservefillrule.cpp
@@ -10,6 +10,7 @@
#include "include/core/SkPath.h"
#include "include/gpu/GrContextOptions.h"
#include "include/gpu/GrRecordingContext.h"
+#include "src/core/SkCanvasPriv.h"
#include "src/gpu/GrDirectContextPriv.h"
#include "src/gpu/GrDrawingManager.h"
#include "src/gpu/GrRecordingContextPriv.h"
@@ -48,14 +49,15 @@
ctxOptions->fAllowPathMaskCaching = true;
}
- DrawResult onDraw(GrRecordingContext* rContext, GrSurfaceDrawContext* rtc, SkCanvas* canvas,
- SkString* errorMsg) override {
+ DrawResult onDraw(GrRecordingContext* rContext, SkCanvas* canvas, SkString* errorMsg) override {
auto dContext = GrAsDirectContext(rContext);
if (!dContext) {
*errorMsg = "Requires a direct context.";
return skiagm::DrawResult::kSkip;
}
+ auto sfc = SkCanvasPriv::TopDeviceSurfaceFillContext(canvas);
+
auto starRect = SkRect::MakeWH(fStarSize, fStarSize);
SkPath star7_winding = ToolUtils::make_star(starRect, 7);
star7_winding.setFillType(SkPathFillType::kWinding);
@@ -81,7 +83,7 @@
canvas->drawPath(star7_evenOdd, paint);
canvas->drawPath(star5_winding, paint);
canvas->drawPath(star5_evenOdd, paint);
- dContext->priv().flushSurface(rtc->asSurfaceProxy());
+ dContext->priv().flushSurface(sfc->asSurfaceProxy());
return DrawResult::kOk;
}