| 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 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 static void AppendQuadsToFillScreen( | 533 static void AppendQuadsToFillScreen( |
| 534 ResourceProvider::ResourceId resource_id, | 534 ResourceProvider::ResourceId resource_id, |
| 535 gfx::SizeF resource_scaled_size, | 535 gfx::SizeF resource_scaled_size, |
| 536 RenderPass* target_render_pass, | 536 RenderPass* target_render_pass, |
| 537 LayerImpl* root_layer, | 537 LayerImpl* root_layer, |
| 538 SkColor screen_background_color, | 538 SkColor screen_background_color, |
| 539 const OcclusionTrackerImpl& occlusion_tracker) { | 539 const OcclusionTrackerImpl& occlusion_tracker) { |
| 540 if (!root_layer || !SkColorGetA(screen_background_color)) | 540 if (!root_layer || !SkColorGetA(screen_background_color)) |
| 541 return; | 541 return; |
| 542 | 542 |
| 543 Region fill_region = occlusion_tracker.ComputeVisibleRegionInScreen(); | 543 Region fill_region = occlusion_tracker.ComputeVisibleRegionInScreen( |
| 544 root_layer->render_surface()->content_rect()); |
| 544 if (fill_region.IsEmpty()) | 545 if (fill_region.IsEmpty()) |
| 545 return; | 546 return; |
| 546 | 547 |
| 547 bool for_surface = false; | 548 bool for_surface = false; |
| 548 QuadCuller quad_culler(&target_render_pass->quad_list, | 549 QuadCuller quad_culler(&target_render_pass->quad_list, |
| 549 &target_render_pass->shared_quad_state_list, | 550 &target_render_pass->shared_quad_state_list, |
| 550 root_layer, | 551 root_layer, |
| 551 occlusion_tracker, | 552 occlusion_tracker, |
| 552 root_layer->ShowDebugBorders(), | 553 root_layer->ShowDebugBorders(), |
| 553 for_surface); | 554 for_surface); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 render_surface->contributes_to_drawn_surface() || | 659 render_surface->contributes_to_drawn_surface() || |
| 659 render_surface_layer->HasCopyRequest(); | 660 render_surface_layer->HasCopyRequest(); |
| 660 if (should_draw_into_render_pass) | 661 if (should_draw_into_render_pass) |
| 661 render_surface_layer->render_surface()->AppendRenderPasses(frame); | 662 render_surface_layer->render_surface()->AppendRenderPasses(frame); |
| 662 } | 663 } |
| 663 | 664 |
| 664 bool record_metrics_for_frame = | 665 bool record_metrics_for_frame = |
| 665 settings_.show_overdraw_in_tracing && | 666 settings_.show_overdraw_in_tracing && |
| 666 base::debug::TraceLog::GetInstance() && | 667 base::debug::TraceLog::GetInstance() && |
| 667 base::debug::TraceLog::GetInstance()->IsEnabled(); | 668 base::debug::TraceLog::GetInstance()->IsEnabled(); |
| 668 OcclusionTrackerImpl occlusion_tracker( | 669 OcclusionTrackerImpl occlusion_tracker(record_metrics_for_frame); |
| 669 active_tree_->root_layer()->render_surface()->content_rect(), | |
| 670 record_metrics_for_frame); | |
| 671 occlusion_tracker.set_minimum_tracking_size( | 670 occlusion_tracker.set_minimum_tracking_size( |
| 672 settings_.minimum_occlusion_tracking_size); | 671 settings_.minimum_occlusion_tracking_size); |
| 673 | 672 |
| 674 if (debug_state_.show_occluding_rects) { | 673 if (debug_state_.show_occluding_rects) { |
| 675 occlusion_tracker.set_occluding_screen_space_rects_container( | 674 occlusion_tracker.set_occluding_screen_space_rects_container( |
| 676 &frame->occluding_screen_space_rects); | 675 &frame->occluding_screen_space_rects); |
| 677 } | 676 } |
| 678 if (debug_state_.show_non_occluding_rects) { | 677 if (debug_state_.show_non_occluding_rects) { |
| 679 occlusion_tracker.set_non_occluding_screen_space_rects_container( | 678 occlusion_tracker.set_non_occluding_screen_space_rects_container( |
| 680 &frame->non_occluding_screen_space_rects); | 679 &frame->non_occluding_screen_space_rects); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 &append_quads_data); | 734 &append_quads_data); |
| 736 } else if (it.represents_itself() && | 735 } else if (it.represents_itself() && |
| 737 !it->visible_content_rect().IsEmpty()) { | 736 !it->visible_content_rect().IsEmpty()) { |
| 738 bool has_occlusion_from_outside_target_surface; | 737 bool has_occlusion_from_outside_target_surface; |
| 739 bool impl_draw_transform_is_unknown = false; | 738 bool impl_draw_transform_is_unknown = false; |
| 740 if (occlusion_tracker.Occluded( | 739 if (occlusion_tracker.Occluded( |
| 741 it->render_target(), | 740 it->render_target(), |
| 742 it->visible_content_rect(), | 741 it->visible_content_rect(), |
| 743 it->draw_transform(), | 742 it->draw_transform(), |
| 744 impl_draw_transform_is_unknown, | 743 impl_draw_transform_is_unknown, |
| 745 it->is_clipped(), | |
| 746 it->clip_rect(), | |
| 747 &has_occlusion_from_outside_target_surface)) { | 744 &has_occlusion_from_outside_target_surface)) { |
| 748 append_quads_data.had_occlusion_from_outside_target_surface |= | 745 append_quads_data.had_occlusion_from_outside_target_surface |= |
| 749 has_occlusion_from_outside_target_surface; | 746 has_occlusion_from_outside_target_surface; |
| 750 } else if (it->WillDraw(draw_mode, resource_provider_.get())) { | 747 } else if (it->WillDraw(draw_mode, resource_provider_.get())) { |
| 751 DCHECK_EQ(active_tree_, it->layer_tree_impl()); | 748 DCHECK_EQ(active_tree_, it->layer_tree_impl()); |
| 752 | 749 |
| 753 frame->will_draw_layers.push_back(*it); | 750 frame->will_draw_layers.push_back(*it); |
| 754 | 751 |
| 755 if (it->HasContributingDelegatedRenderPasses()) { | 752 if (it->HasContributingDelegatedRenderPasses()) { |
| 756 RenderPass::Id contributing_render_pass_id = | 753 RenderPass::Id contributing_render_pass_id = |
| (...skipping 1892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2649 | 2646 |
| 2650 ResourceProvider::ResourceId LayerTreeHostImpl::ResourceIdForUIResource( | 2647 ResourceProvider::ResourceId LayerTreeHostImpl::ResourceIdForUIResource( |
| 2651 UIResourceId uid) const { | 2648 UIResourceId uid) const { |
| 2652 UIResourceMap::const_iterator iter = ui_resource_map_.find(uid); | 2649 UIResourceMap::const_iterator iter = ui_resource_map_.find(uid); |
| 2653 if (iter != ui_resource_map_.end()) | 2650 if (iter != ui_resource_map_.end()) |
| 2654 return iter->second; | 2651 return iter->second; |
| 2655 return 0; | 2652 return 0; |
| 2656 } | 2653 } |
| 2657 | 2654 |
| 2658 } // namespace cc | 2655 } // namespace cc |
| OLD | NEW |