Index: cc/trees/layer_tree_host_impl.cc |
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc |
index 32c1db514e2e1b110c271b3afdb313ebb834a045..59c733ec682b764554bdf6100a329e08295a0c0e 100644 |
--- a/cc/trees/layer_tree_host_impl.cc |
+++ b/cc/trees/layer_tree_host_impl.cc |
@@ -690,14 +690,16 @@ DrawResult LayerTreeHostImpl::CalculateRenderPasses( |
// frame at all. |
RenderSurfaceImpl* root_surface = |
active_tree_->root_layer()->render_surface(); |
+ gfx::Rect damage_rect_with_overlays = |
+ gfx::UnionRects(root_surface->damage_tracker()->current_damage_rect(), |
+ root_surface->damage_tracker()->current_overlay_rect()); |
bool root_surface_has_no_visible_damage = |
- !root_surface->damage_tracker()->current_damage_rect().Intersects( |
- root_surface->content_rect()); |
- bool root_surface_has_contributing_layers = |
+ !damage_rect_with_overlays.Intersects(root_surface->content_rect()); |
+ bool root_surface_has_no_contributing_layers = |
!root_surface->layer_list().empty(); |
bool hud_wants_to_draw_ = active_tree_->hud_layer() && |
active_tree_->hud_layer()->IsAnimatingHUDContents(); |
- if (root_surface_has_contributing_layers && |
+ if (root_surface_has_no_contributing_layers && |
root_surface_has_no_visible_damage && |
active_tree_->LayersWithCopyOutputRequest().empty() && |
!output_surface_->capabilities().can_force_reclaim_resources && |
@@ -899,6 +901,15 @@ DrawResult LayerTreeHostImpl::CalculateRenderPasses( |
} |
RemoveRenderPasses(CullRenderPassesWithNoQuads(), frame); |
+ |
+ // Only the root render pass is allowed to have overlays, so we can merge |
+ // in all quad damage for the other ones now. |
+ for (size_t i = 0; i < frame->render_passes.size() - 1; ++i) { |
+ RenderPass* pass = frame->render_passes.at(i); |
+ pass->damage_rect.Union(pass->overlay_rect); |
+ pass->overlay_rect = gfx::Rect(); |
+ } |
+ |
renderer_->DecideRenderPassAllocationsForFrame(frame->render_passes); |
// Any copy requests left in the tree are not going to get serviced, and |