aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2016-04-28 14:32:04 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-28 14:32:04 -0700
commit175dd9b5e3d7d749738dac743d2ac360b5340187 (patch)
treeff0ab4b2fb12c714a1723775d031220a68225d6d /tools
parent801b44c45348144a483793e7b24f4d4092a4f74d (diff)
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
Diffstat (limited to 'tools')
-rw-r--r--tools/VisualBench/WrappedBenchmark.h14
-rw-r--r--tools/debugger/SkDebugCanvas.cpp9
2 files changed, 12 insertions, 11 deletions
diff --git a/tools/VisualBench/WrappedBenchmark.h b/tools/VisualBench/WrappedBenchmark.h
index ddf601ddf8..8939fda319 100644
--- a/tools/VisualBench/WrappedBenchmark.h
+++ b/tools/VisualBench/WrappedBenchmark.h
@@ -11,6 +11,7 @@
#include "Benchmark.h"
#include "SkSurface.h"
#include "GrContext.h"
+#include "GrDrawContext.h"
#include "GrRenderTarget.h"
// Wrap some other benchmark to allow specialization to either
@@ -112,15 +113,18 @@ private:
void onBlitToScreen(SkCanvas* canvas, int w, int h) override {
// We call copySurface directly on the underlying GPU surfaces for a more efficient blit.
- GrRenderTarget* dst = canvas->internal_private_accessTopLayerRenderTarget();
- SkASSERT(dst);
+ GrDrawContext* dstDC = canvas->internal_private_accessTopLayerDrawContext();
+ SkASSERT(dstDC);
- GrRenderTarget* src = fOffScreen->getCanvas()->internal_private_accessTopLayerRenderTarget();
+ GrDrawContext* srcDC =
+ fOffScreen->getCanvas()->internal_private_accessTopLayerDrawContext();
+ SkASSERT(srcDC);
+ GrRenderTarget* src = srcDC->accessRenderTarget();
SkASSERT(src);
- SkASSERT(dst->getContext() == src->getContext());
+ SkASSERT(canvas->getGrContext() == fOffScreen->getCanvas()->getGrContext());
- dst->getContext()->copySurface(dst, src, SkIRect::MakeWH(w, h), SkIPoint::Make(0, 0));
+ dstDC->copySurface(src, SkIRect::MakeWH(w, h), SkIPoint::Make(0, 0));
}
int fNumSamples;
diff --git a/tools/debugger/SkDebugCanvas.cpp b/tools/debugger/SkDebugCanvas.cpp
index 8568029d38..5ee22eba3f 100644
--- a/tools/debugger/SkDebugCanvas.cpp
+++ b/tools/debugger/SkDebugCanvas.cpp
@@ -418,12 +418,9 @@ SkTDArray <SkDrawCommand*>& SkDebugCanvas::getDrawCommands() {
GrAuditTrail* SkDebugCanvas::getAuditTrail(SkCanvas* canvas) {
GrAuditTrail* at = nullptr;
#if SK_SUPPORT_GPU
- GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget();
- if (rt) {
- GrContext* ctx = rt->getContext();
- if (ctx) {
- at = ctx->getAuditTrail();
- }
+ GrContext* ctx = canvas->getGrContext();
+ if (ctx) {
+ at = ctx->getAuditTrail();
}
#endif
return at;