Index: tools/VisualBench/WrappedBenchmark.h |
diff --git a/tools/VisualBench/WrappedBenchmark.h b/tools/VisualBench/WrappedBenchmark.h |
index ddf601ddf8331ed80a1b32eccaeafa2d7f43dd05..bd88f13502ead965cb79cc2a0c182c639a59fd22 100644 |
--- a/tools/VisualBench/WrappedBenchmark.h |
+++ b/tools/VisualBench/WrappedBenchmark.h |
@@ -9,6 +9,7 @@ |
#define WrappedBenchmark_DEFINED |
#include "Benchmark.h" |
+#include "SkDevice.h" |
#include "SkSurface.h" |
#include "GrContext.h" |
#include "GrRenderTarget.h" |
@@ -112,15 +113,26 @@ |
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); |
+ GrRenderTarget* dst, *src; |
- GrRenderTarget* src = fOffScreen->getCanvas()->internal_private_accessTopLayerRenderTarget(); |
- SkASSERT(src); |
+ SkCanvas::LayerIter canvasIter(canvas, false); |
+ SkAssertResult((dst = canvasIter.device()->accessRenderTarget())); |
+ |
+ SkCanvas::LayerIter offscreenIter(fOffScreen->getCanvas(), false); |
+ SkAssertResult((src = offscreenIter.device()->accessRenderTarget())); |
SkASSERT(dst->getContext() == src->getContext()); |
dst->getContext()->copySurface(dst, src, SkIRect::MakeWH(w, h), SkIPoint::Make(0, 0)); |
+ |
+#ifdef SK_DEBUG |
+ // This method should not be called while layers are saved. |
+ canvasIter.next(); |
+ SkASSERT(canvasIter.done()); |
+ |
+ offscreenIter.next(); |
+ SkASSERT(offscreenIter.done()); |
+#endif |
} |
int fNumSamples; |