Move canvas clear after preroll (flutter/engine#7923)

This will reduce 1 render target switch when preroll paints some raster
cache.
This commit is contained in:
liyuqian
2019-02-22 12:48:04 -08:00
committed by GitHub
parent eccfd67b6c
commit 79c1a3fcdf
2 changed files with 5 additions and 4 deletions

View File

@@ -63,6 +63,11 @@ CompositorContext::ScopedFrame::~ScopedFrame() {
bool CompositorContext::ScopedFrame::Raster(flow::LayerTree& layer_tree,
bool ignore_raster_cache) {
layer_tree.Preroll(*this, ignore_raster_cache);
// Clearing canvas after preroll reduces one render target switch when preroll
// paints some raster cache.
if (canvas()) {
canvas()->clear(SK_ColorTRANSPARENT);
}
layer_tree.Paint(*this, ignore_raster_cache);
return true;
}

View File

@@ -181,10 +181,6 @@ bool Rasterizer::DrawToSurface(flow::LayerTree& layer_tree) {
surface_->GetContext(), canvas, external_view_embedder,
surface_->GetRootTransformation(), true);
if (canvas) {
canvas->clear(SK_ColorTRANSPARENT);
}
if (compositor_frame && compositor_frame->Raster(layer_tree, false)) {
frame->Submit();
if (external_view_embedder != nullptr) {