Skip to content

Commit

Permalink
Move canvas clear after preroll (flutter#7923)
Browse files Browse the repository at this point in the history
This will reduce 1 render target switch when preroll paints some raster
cache.
  • Loading branch information
liyuqian authored Feb 22, 2019
1 parent 8529dbc commit e2a449a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 5 additions & 0 deletions flow/compositor_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 0 additions & 4 deletions shell/common/rasterizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit e2a449a

Please sign in to comment.