Remove uses of SkCanvas::flush
afaict the perf surprises associated with:
https://skia-review.googlesource.com/c/skia/+/334417 (Remove SkBaseDevice::flush)
were bc Ganesh resolves MSAA buffers for SkCanvas::flush but doesn't do so for GrDirectContext::flush.
Where possible this CL switches SkCanvas::flush to SkSurface::flush (which will also resolve MSAA buffers) so that when https://skia-review.googlesource.com/c/skia/+/334417 relands there should not be any performance surprises.
Change-Id: I705ad6219f0f625a88cf3f9e8b2418a3182d298c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335866
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
diff --git a/tools/debugger/DebugLayerManager.cpp b/tools/debugger/DebugLayerManager.cpp
index 736cacc..a070d53 100644
--- a/tools/debugger/DebugLayerManager.cpp
+++ b/tools/debugger/DebugLayerManager.cpp
@@ -66,10 +66,10 @@
keys.push_back(k);
}
-void DebugLayerManager::drawLayerEventTo(SkCanvas* canvas, const int nodeId, const int frame) {
+void DebugLayerManager::drawLayerEventTo(SkSurface* surface, const int nodeId, const int frame) {
auto& evt = fDraws[{frame, nodeId}];
- evt.debugCanvas->drawTo(canvas, evt.command);
- canvas->flush();
+ evt.debugCanvas->drawTo(surface->getCanvas(), evt.command);
+ surface->flush();
}
sk_sp<SkImage> DebugLayerManager::getLayerAsImage(const int nodeId, const int frame) {
@@ -105,9 +105,8 @@
// draw everything from the last full redraw up to the current frame.
// other frames drawn are partial, meaning they were clipped to not completely cover the layer.
// count back up with i
- auto* canvas = surface->getCanvas();
for (; i<relevantFrames.size() && relevantFrames[i]<=frameN; i++) {
- drawLayerEventTo(canvas, nodeId, relevantFrames[i]);
+ drawLayerEventTo(surface.get(), nodeId, relevantFrames[i]);
}
drawEvent.image = surface->makeImageSnapshot();
return drawEvent.image;