| 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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 static void AppendQuadsToFillScreen( | 563 static void AppendQuadsToFillScreen( |
| 564 ResourceProvider::ResourceId resource_id, | 564 ResourceProvider::ResourceId resource_id, |
| 565 gfx::SizeF resource_scaled_size, | 565 gfx::SizeF resource_scaled_size, |
| 566 RenderPass* target_render_pass, | 566 RenderPass* target_render_pass, |
| 567 LayerImpl* root_layer, | 567 LayerImpl* root_layer, |
| 568 SkColor screen_background_color, | 568 SkColor screen_background_color, |
| 569 const OcclusionTrackerImpl& occlusion_tracker) { | 569 const OcclusionTrackerImpl& occlusion_tracker) { |
| 570 if (!root_layer || !SkColorGetA(screen_background_color)) | 570 if (!root_layer || !SkColorGetA(screen_background_color)) |
| 571 return; | 571 return; |
| 572 | 572 |
| 573 Region fill_region = occlusion_tracker.ComputeVisibleRegionInScreen(); | 573 Region fill_region = occlusion_tracker.ComputeVisibleRegionInScreen( |
| 574 root_layer->render_surface()->content_rect()); |
| 574 if (fill_region.IsEmpty()) | 575 if (fill_region.IsEmpty()) |
| 575 return; | 576 return; |
| 576 | 577 |
| 577 bool for_surface = false; | 578 bool for_surface = false; |
| 578 QuadCuller quad_culler(&target_render_pass->quad_list, | 579 QuadCuller quad_culler(&target_render_pass->quad_list, |
| 579 &target_render_pass->shared_quad_state_list, | 580 &target_render_pass->shared_quad_state_list, |
| 580 root_layer, | 581 root_layer, |
| 581 occlusion_tracker, | 582 occlusion_tracker, |
| 582 root_layer->ShowDebugBorders(), | 583 root_layer->ShowDebugBorders(), |
| 583 for_surface); | 584 for_surface); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 render_surface->contributes_to_drawn_surface() || | 689 render_surface->contributes_to_drawn_surface() || |
| 689 render_surface_layer->HasCopyRequest(); | 690 render_surface_layer->HasCopyRequest(); |
| 690 if (should_draw_into_render_pass) | 691 if (should_draw_into_render_pass) |
| 691 render_surface_layer->render_surface()->AppendRenderPasses(frame); | 692 render_surface_layer->render_surface()->AppendRenderPasses(frame); |
| 692 } | 693 } |
| 693 | 694 |
| 694 bool record_metrics_for_frame = | 695 bool record_metrics_for_frame = |
| 695 settings_.show_overdraw_in_tracing && | 696 settings_.show_overdraw_in_tracing && |
| 696 base::debug::TraceLog::GetInstance() && | 697 base::debug::TraceLog::GetInstance() && |
| 697 base::debug::TraceLog::GetInstance()->IsEnabled(); | 698 base::debug::TraceLog::GetInstance()->IsEnabled(); |
| 698 OcclusionTrackerImpl occlusion_tracker( | 699 OcclusionTrackerImpl occlusion_tracker(record_metrics_for_frame); |
| 699 active_tree_->root_layer()->render_surface()->content_rect(), | |
| 700 record_metrics_for_frame); | |
| 701 occlusion_tracker.set_minimum_tracking_size( | 700 occlusion_tracker.set_minimum_tracking_size( |
| 702 settings_.minimum_occlusion_tracking_size); | 701 settings_.minimum_occlusion_tracking_size); |
| 703 | 702 |
| 704 if (debug_state_.show_occluding_rects) { | 703 if (debug_state_.show_occluding_rects) { |
| 705 occlusion_tracker.set_occluding_screen_space_rects_container( | 704 occlusion_tracker.set_occluding_screen_space_rects_container( |
| 706 &frame->occluding_screen_space_rects); | 705 &frame->occluding_screen_space_rects); |
| 707 } | 706 } |
| 708 if (debug_state_.show_non_occluding_rects) { | 707 if (debug_state_.show_non_occluding_rects) { |
| 709 occlusion_tracker.set_non_occluding_screen_space_rects_container( | 708 occlusion_tracker.set_non_occluding_screen_space_rects_container( |
| 710 &frame->non_occluding_screen_space_rects); | 709 &frame->non_occluding_screen_space_rects); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 &append_quads_data); | 764 &append_quads_data); |
| 766 } else if (it.represents_itself() && | 765 } else if (it.represents_itself() && |
| 767 !it->visible_content_rect().IsEmpty()) { | 766 !it->visible_content_rect().IsEmpty()) { |
| 768 bool has_occlusion_from_outside_target_surface; | 767 bool has_occlusion_from_outside_target_surface; |
| 769 bool impl_draw_transform_is_unknown = false; | 768 bool impl_draw_transform_is_unknown = false; |
| 770 if (occlusion_tracker.Occluded( | 769 if (occlusion_tracker.Occluded( |
| 771 it->render_target(), | 770 it->render_target(), |
| 772 it->visible_content_rect(), | 771 it->visible_content_rect(), |
| 773 it->draw_transform(), | 772 it->draw_transform(), |
| 774 impl_draw_transform_is_unknown, | 773 impl_draw_transform_is_unknown, |
| 775 it->is_clipped(), | |
| 776 it->clip_rect(), | |
| 777 &has_occlusion_from_outside_target_surface)) { | 774 &has_occlusion_from_outside_target_surface)) { |
| 778 append_quads_data.had_occlusion_from_outside_target_surface |= | 775 append_quads_data.had_occlusion_from_outside_target_surface |= |
| 779 has_occlusion_from_outside_target_surface; | 776 has_occlusion_from_outside_target_surface; |
| 780 } else if (it->WillDraw(draw_mode, resource_provider_.get())) { | 777 } else if (it->WillDraw(draw_mode, resource_provider_.get())) { |
| 781 DCHECK_EQ(active_tree_, it->layer_tree_impl()); | 778 DCHECK_EQ(active_tree_, it->layer_tree_impl()); |
| 782 | 779 |
| 783 frame->will_draw_layers.push_back(*it); | 780 frame->will_draw_layers.push_back(*it); |
| 784 | 781 |
| 785 if (it->HasContributingDelegatedRenderPasses()) { | 782 if (it->HasContributingDelegatedRenderPasses()) { |
| 786 RenderPass::Id contributing_render_pass_id = | 783 RenderPass::Id contributing_render_pass_id = |
| (...skipping 1909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2696 std::set<UIResourceId>::iterator found_in_evicted = | 2693 std::set<UIResourceId>::iterator found_in_evicted = |
| 2697 evicted_ui_resources_.find(uid); | 2694 evicted_ui_resources_.find(uid); |
| 2698 if (found_in_evicted == evicted_ui_resources_.end()) | 2695 if (found_in_evicted == evicted_ui_resources_.end()) |
| 2699 return; | 2696 return; |
| 2700 evicted_ui_resources_.erase(found_in_evicted); | 2697 evicted_ui_resources_.erase(found_in_evicted); |
| 2701 if (evicted_ui_resources_.empty()) | 2698 if (evicted_ui_resources_.empty()) |
| 2702 client_->OnCanDrawStateChanged(CanDraw()); | 2699 client_->OnCanDrawStateChanged(CanDraw()); |
| 2703 } | 2700 } |
| 2704 | 2701 |
| 2705 } // namespace cc | 2702 } // namespace cc |
| OLD | NEW |