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/texturedomaineffect.cpp b/gm/texturedomaineffect.cpp
index e4a02c1..6607488 100644
--- a/gm/texturedomaineffect.cpp
+++ b/gm/texturedomaineffect.cpp
@@ -70,18 +70,14 @@
}
void onDraw(SkCanvas* canvas) override {
- GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget();
- if (nullptr == rt) {
- return;
- }
- GrContext* context = rt->getContext();
- if (nullptr == context) {
+ GrDrawContext* drawContext = canvas->internal_private_accessTopLayerDrawContext();
+ if (!drawContext) {
skiagm::GM::DrawGpuOnlyMessage(canvas);
return;
}
- sk_sp<GrDrawContext> drawContext(context->drawContext(sk_ref_sp(rt)));
- if (!drawContext) {
+ GrContext* context = canvas->getGrContext();
+ if (!context) {
return;
}
@@ -128,7 +124,7 @@
continue;
}
const SkMatrix viewMatrix = SkMatrix::MakeTrans(x, y);
- pipelineBuilder.setRenderTarget(rt);
+ pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget());
pipelineBuilder.addColorFragmentProcessor(fp);
SkAutoTUnref<GrDrawBatch> batch(