| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 DCHECK(CanDraw()); | 683 DCHECK(CanDraw()); |
| 684 DCHECK(active_tree_->root_layer()); | 684 DCHECK(active_tree_->root_layer()); |
| 685 | 685 |
| 686 TrackDamageForAllSurfaces(active_tree_->root_layer(), | 686 TrackDamageForAllSurfaces(active_tree_->root_layer(), |
| 687 *frame->render_surface_layer_list); | 687 *frame->render_surface_layer_list); |
| 688 | 688 |
| 689 // If the root render surface has no visible damage, then don't generate a | 689 // If the root render surface has no visible damage, then don't generate a |
| 690 // frame at all. | 690 // frame at all. |
| 691 RenderSurfaceImpl* root_surface = | 691 RenderSurfaceImpl* root_surface = |
| 692 active_tree_->root_layer()->render_surface(); | 692 active_tree_->root_layer()->render_surface(); |
| 693 gfx::Rect damage_rect_with_overlays = |
| 694 gfx::UnionRects(root_surface->damage_tracker()->current_damage_rect(), |
| 695 root_surface->damage_tracker()->current_overlay_rect()); |
| 693 bool root_surface_has_no_visible_damage = | 696 bool root_surface_has_no_visible_damage = |
| 694 !root_surface->damage_tracker()->current_damage_rect().Intersects( | 697 !damage_rect_with_overlays.Intersects(root_surface->content_rect()); |
| 695 root_surface->content_rect()); | 698 bool root_surface_has_no_contributing_layers = |
| 696 bool root_surface_has_contributing_layers = | |
| 697 !root_surface->layer_list().empty(); | 699 !root_surface->layer_list().empty(); |
| 698 bool hud_wants_to_draw_ = active_tree_->hud_layer() && | 700 bool hud_wants_to_draw_ = active_tree_->hud_layer() && |
| 699 active_tree_->hud_layer()->IsAnimatingHUDContents(); | 701 active_tree_->hud_layer()->IsAnimatingHUDContents(); |
| 700 if (root_surface_has_contributing_layers && | 702 if (root_surface_has_no_contributing_layers && |
| 701 root_surface_has_no_visible_damage && | 703 root_surface_has_no_visible_damage && |
| 702 active_tree_->LayersWithCopyOutputRequest().empty() && | 704 active_tree_->LayersWithCopyOutputRequest().empty() && |
| 703 !output_surface_->capabilities().can_force_reclaim_resources && | 705 !output_surface_->capabilities().can_force_reclaim_resources && |
| 704 !hud_wants_to_draw_) { | 706 !hud_wants_to_draw_) { |
| 705 TRACE_EVENT0("cc", | 707 TRACE_EVENT0("cc", |
| 706 "LayerTreeHostImpl::CalculateRenderPasses::EmptyDamageRect"); | 708 "LayerTreeHostImpl::CalculateRenderPasses::EmptyDamageRect"); |
| 707 frame->has_no_damage = true; | 709 frame->has_no_damage = true; |
| 708 DCHECK(!output_surface_->capabilities() | 710 DCHECK(!output_surface_->capabilities() |
| 709 .draw_and_swap_full_viewport_every_frame); | 711 .draw_and_swap_full_viewport_every_frame); |
| 710 return DRAW_SUCCESS; | 712 return DRAW_SUCCESS; |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 | 894 |
| 893 if (!active_tree_->has_transparent_background()) { | 895 if (!active_tree_->has_transparent_background()) { |
| 894 frame->render_passes.back()->has_transparent_background = false; | 896 frame->render_passes.back()->has_transparent_background = false; |
| 895 AppendQuadsToFillScreen( | 897 AppendQuadsToFillScreen( |
| 896 active_tree_->RootScrollLayerDeviceViewportBounds(), | 898 active_tree_->RootScrollLayerDeviceViewportBounds(), |
| 897 frame->render_passes.back(), active_tree_->root_layer(), | 899 frame->render_passes.back(), active_tree_->root_layer(), |
| 898 active_tree_->background_color(), unoccluded_screen_space_region); | 900 active_tree_->background_color(), unoccluded_screen_space_region); |
| 899 } | 901 } |
| 900 | 902 |
| 901 RemoveRenderPasses(CullRenderPassesWithNoQuads(), frame); | 903 RemoveRenderPasses(CullRenderPassesWithNoQuads(), frame); |
| 904 |
| 905 // Only the root render pass is allowed to have overlays, so we can merge |
| 906 // in all quad damage for the other ones now. |
| 907 for (size_t i = 0; i < frame->render_passes.size() - 1; ++i) { |
| 908 RenderPass* pass = frame->render_passes.at(i); |
| 909 pass->RecalculateOverlayDamage(); |
| 910 pass->UnionOverlayDamage(); |
| 911 } |
| 912 frame->render_passes.back()->RecalculateOverlayDamage(); |
| 913 |
| 902 renderer_->DecideRenderPassAllocationsForFrame(frame->render_passes); | 914 renderer_->DecideRenderPassAllocationsForFrame(frame->render_passes); |
| 903 | 915 |
| 904 // Any copy requests left in the tree are not going to get serviced, and | 916 // Any copy requests left in the tree are not going to get serviced, and |
| 905 // should be aborted. | 917 // should be aborted. |
| 906 ScopedPtrVector<CopyOutputRequest> requests_to_abort; | 918 ScopedPtrVector<CopyOutputRequest> requests_to_abort; |
| 907 while (!active_tree_->LayersWithCopyOutputRequest().empty()) { | 919 while (!active_tree_->LayersWithCopyOutputRequest().empty()) { |
| 908 LayerImpl* layer = active_tree_->LayersWithCopyOutputRequest().back(); | 920 LayerImpl* layer = active_tree_->LayersWithCopyOutputRequest().back(); |
| 909 layer->TakeCopyRequestsAndTransformToTarget(&requests_to_abort); | 921 layer->TakeCopyRequestsAndTransformToTarget(&requests_to_abort); |
| 910 } | 922 } |
| 911 for (size_t i = 0; i < requests_to_abort.size(); ++i) | 923 for (size_t i = 0; i < requests_to_abort.size(); ++i) |
| (...skipping 2555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3467 new_target.SetToMin(layer_impl->MaxScrollOffset()); | 3479 new_target.SetToMin(layer_impl->MaxScrollOffset()); |
| 3468 | 3480 |
| 3469 curve->UpdateTarget( | 3481 curve->UpdateTarget( |
| 3470 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) | 3482 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) |
| 3471 .InSecondsF(), | 3483 .InSecondsF(), |
| 3472 new_target); | 3484 new_target); |
| 3473 | 3485 |
| 3474 return true; | 3486 return true; |
| 3475 } | 3487 } |
| 3476 } // namespace cc | 3488 } // namespace cc |
| OLD | NEW |