Clean up test drawContext usage
The general idea is to provide access to SkGpuDevice's drawContext rather than its GrRenderTarget. That is usually what the testing framework actually wants.
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1930623003
Review-Url: https://codereview.chromium.org/1930623003
diff --git a/gm/rrects.cpp b/gm/rrects.cpp
index 57c11ad..9f1c65d 100644
--- a/gm/rrects.cpp
+++ b/gm/rrects.cpp
@@ -62,24 +62,8 @@
SkISize onISize() override { return SkISize::Make(kImageWidth, kImageHeight); }
void onDraw(SkCanvas* canvas) override {
- GrContext* context = nullptr;
-#if SK_SUPPORT_GPU
- GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget();
- context = rt ? rt->getContext() : nullptr;
- sk_sp<GrDrawContext> drawContext;
- if (kEffect_Type == fType) {
- if (!context) {
- skiagm::GM::DrawGpuOnlyMessage(canvas);
- return;
- }
-
- drawContext = context->drawContext(sk_ref_sp(rt));
- if (!drawContext) {
- return;
- }
- }
-#endif
- if (kEffect_Type == fType && nullptr == context) {
+ GrDrawContext* drawContext = canvas->internal_private_accessTopLayerDrawContext();
+ if (kEffect_Type == fType && !drawContext) {
skiagm::GM::DrawGpuOnlyMessage(canvas);
return;
}
@@ -128,7 +112,7 @@
rrect));
if (fp) {
pipelineBuilder.addCoverageFragmentProcessor(fp);
- pipelineBuilder.setRenderTarget(rt);
+ pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget());
SkRect bounds = rrect.getBounds();
bounds.outset(2.f, 2.f);