Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: tools/VisualBench/WrappedBenchmark.h

Issue 1906573003: Revert of Hide SkCanvas::LayerIter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/CanvasTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « tests/CanvasTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698