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_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 | 1135 |
1136 // Resourceless draw do not need tiles and should not affect existing tile | 1136 // Resourceless draw do not need tiles and should not affect existing tile |
1137 // priorities. | 1137 // priorities. |
1138 if (!is_in_resourceless_software_draw_mode()) { | 1138 if (!is_in_resourceless_software_draw_mode()) { |
1139 TRACE_EVENT_BEGIN2("cc", "LayerTreeImpl::UpdateDrawProperties::UpdateTiles", | 1139 TRACE_EVENT_BEGIN2("cc", "LayerTreeImpl::UpdateDrawProperties::UpdateTiles", |
1140 "IsActive", IsActiveTree(), "SourceFrameNumber", | 1140 "IsActive", IsActiveTree(), "SourceFrameNumber", |
1141 source_frame_number_); | 1141 source_frame_number_); |
1142 size_t layers_updated_count = 0; | 1142 size_t layers_updated_count = 0; |
1143 bool tile_priorities_updated = false; | 1143 bool tile_priorities_updated = false; |
1144 for (PictureLayerImpl* layer : picture_layers_) { | 1144 for (PictureLayerImpl* layer : picture_layers_) { |
1145 if (!layer->is_drawn_render_surface_layer_list_member()) | 1145 if (!layer->contributes_to_drawn_render_surface()) |
1146 continue; | 1146 continue; |
1147 ++layers_updated_count; | 1147 ++layers_updated_count; |
1148 tile_priorities_updated |= layer->UpdateTiles(); | 1148 tile_priorities_updated |= layer->UpdateTiles(); |
1149 } | 1149 } |
1150 | 1150 |
1151 if (tile_priorities_updated) | 1151 if (tile_priorities_updated) |
1152 DidModifyTilePriorities(); | 1152 DidModifyTilePriorities(); |
1153 | 1153 |
1154 TRACE_EVENT_END1("cc", "LayerTreeImpl::UpdateDrawProperties::UpdateTiles", | 1154 TRACE_EVENT_END1("cc", "LayerTreeImpl::UpdateDrawProperties::UpdateTiles", |
1155 "layers_updated_count", layers_updated_count); | 1155 "layers_updated_count", layers_updated_count); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1450 } | 1450 } |
1451 | 1451 |
1452 void LayerTreeImpl::SetNeedsRedraw() { | 1452 void LayerTreeImpl::SetNeedsRedraw() { |
1453 layer_tree_host_impl_->SetNeedsRedraw(); | 1453 layer_tree_host_impl_->SetNeedsRedraw(); |
1454 } | 1454 } |
1455 | 1455 |
1456 void LayerTreeImpl::GetAllPrioritizedTilesForTracing( | 1456 void LayerTreeImpl::GetAllPrioritizedTilesForTracing( |
1457 std::vector<PrioritizedTile>* prioritized_tiles) const { | 1457 std::vector<PrioritizedTile>* prioritized_tiles) const { |
1458 for (auto it = layer_list_.rbegin(); it != layer_list_.rend(); ++it) { | 1458 for (auto it = layer_list_.rbegin(); it != layer_list_.rend(); ++it) { |
1459 LayerImpl* layer_impl = *it; | 1459 LayerImpl* layer_impl = *it; |
1460 if (!layer_impl->is_drawn_render_surface_layer_list_member()) | 1460 if (!layer_impl->contributes_to_drawn_render_surface()) |
1461 continue; | 1461 continue; |
1462 layer_impl->GetAllPrioritizedTilesForTracing(prioritized_tiles); | 1462 layer_impl->GetAllPrioritizedTilesForTracing(prioritized_tiles); |
1463 } | 1463 } |
1464 } | 1464 } |
1465 | 1465 |
1466 void LayerTreeImpl::AsValueInto(base::trace_event::TracedValue* state) const { | 1466 void LayerTreeImpl::AsValueInto(base::trace_event::TracedValue* state) const { |
1467 TracedValue::MakeDictIntoImplicitSnapshot(state, "cc::LayerTreeImpl", this); | 1467 TracedValue::MakeDictIntoImplicitSnapshot(state, "cc::LayerTreeImpl", this); |
1468 state->SetInteger("source_frame_number", source_frame_number_); | 1468 state->SetInteger("source_frame_number", source_frame_number_); |
1469 | 1469 |
1470 state->BeginArray("render_surface_layer_list"); | 1470 state->BeginArray("render_surface_layer_list"); |
1471 for (auto it = layer_list_.rbegin(); it != layer_list_.rend(); ++it) { | 1471 for (auto it = layer_list_.rbegin(); it != layer_list_.rend(); ++it) { |
1472 if (!(*it)->is_drawn_render_surface_layer_list_member()) | 1472 if (!(*it)->contributes_to_drawn_render_surface()) |
1473 continue; | 1473 continue; |
1474 TracedValue::AppendIDRef(*it, state); | 1474 TracedValue::AppendIDRef(*it, state); |
1475 } | 1475 } |
1476 state->EndArray(); | 1476 state->EndArray(); |
1477 | 1477 |
1478 state->BeginArray("swap_promise_trace_ids"); | 1478 state->BeginArray("swap_promise_trace_ids"); |
1479 for (const auto& swap_promise : swap_promise_list_) | 1479 for (const auto& swap_promise : swap_promise_list_) |
1480 state->AppendDouble(swap_promise->TraceId()); | 1480 state->AppendDouble(swap_promise->TraceId()); |
1481 state->EndArray(); | 1481 state->EndArray(); |
1482 | 1482 |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1796 return layer_space_region.Contains( | 1796 return layer_space_region.Contains( |
1797 gfx::ToRoundedPoint(hit_test_point_in_layer_space)); | 1797 gfx::ToRoundedPoint(hit_test_point_in_layer_space)); |
1798 } | 1798 } |
1799 | 1799 |
1800 static const gfx::Transform SurfaceScreenSpaceTransform( | 1800 static const gfx::Transform SurfaceScreenSpaceTransform( |
1801 const LayerImpl* layer) { | 1801 const LayerImpl* layer) { |
1802 const PropertyTrees* property_trees = | 1802 const PropertyTrees* property_trees = |
1803 layer->layer_tree_impl()->property_trees(); | 1803 layer->layer_tree_impl()->property_trees(); |
1804 RenderSurfaceImpl* render_surface = layer->GetRenderSurface(); | 1804 RenderSurfaceImpl* render_surface = layer->GetRenderSurface(); |
1805 DCHECK(render_surface); | 1805 DCHECK(render_surface); |
1806 return layer->is_drawn_render_surface_layer_list_member() | 1806 return layer->contributes_to_drawn_render_surface() |
1807 ? render_surface->screen_space_transform() | 1807 ? render_surface->screen_space_transform() |
1808 : property_trees | 1808 : property_trees |
1809 ->ToScreenSpaceTransformWithoutSurfaceContentsScale( | 1809 ->ToScreenSpaceTransformWithoutSurfaceContentsScale( |
1810 render_surface->TransformTreeIndex(), | 1810 render_surface->TransformTreeIndex(), |
1811 render_surface->EffectTreeIndex()); | 1811 render_surface->EffectTreeIndex()); |
1812 } | 1812 } |
1813 | 1813 |
1814 static bool PointIsClippedByAncestorClipNode( | 1814 static bool PointIsClippedByAncestorClipNode( |
1815 const gfx::PointF& screen_space_point, | 1815 const gfx::PointF& screen_space_point, |
1816 const LayerImpl* layer) { | 1816 const LayerImpl* layer) { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1949 FindClosestMatchingLayerState state; | 1949 FindClosestMatchingLayerState state; |
1950 LayerImpl* root_layer = layer_list_.empty() ? nullptr : layer_list_[0]; | 1950 LayerImpl* root_layer = layer_list_.empty() ? nullptr : layer_list_[0]; |
1951 FindClosestMatchingLayer(screen_space_point, root_layer, | 1951 FindClosestMatchingLayer(screen_space_point, root_layer, |
1952 FindScrollingLayerOrDrawnScrollbarFunctor(), &state); | 1952 FindScrollingLayerOrDrawnScrollbarFunctor(), &state); |
1953 return state.closest_match; | 1953 return state.closest_match; |
1954 } | 1954 } |
1955 | 1955 |
1956 struct HitTestVisibleScrollableOrTouchableFunctor { | 1956 struct HitTestVisibleScrollableOrTouchableFunctor { |
1957 bool operator()(LayerImpl* layer) const { | 1957 bool operator()(LayerImpl* layer) const { |
1958 return layer->scrollable() || | 1958 return layer->scrollable() || |
1959 layer->is_drawn_render_surface_layer_list_member() || | 1959 layer->contributes_to_drawn_render_surface() || |
1960 !layer->touch_event_handler_region().IsEmpty(); | 1960 !layer->touch_event_handler_region().IsEmpty(); |
1961 } | 1961 } |
1962 }; | 1962 }; |
1963 | 1963 |
1964 LayerImpl* LayerTreeImpl::FindLayerThatIsHitByPoint( | 1964 LayerImpl* LayerTreeImpl::FindLayerThatIsHitByPoint( |
1965 const gfx::PointF& screen_space_point) { | 1965 const gfx::PointF& screen_space_point) { |
1966 if (layer_list_.empty()) | 1966 if (layer_list_.empty()) |
1967 return NULL; | 1967 return NULL; |
1968 bool update_lcd_text = false; | 1968 bool update_lcd_text = false; |
1969 if (!UpdateDrawProperties(update_lcd_text)) | 1969 if (!UpdateDrawProperties(update_lcd_text)) |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2120 | 2120 |
2121 void LayerTreeImpl::ResetAllChangeTracking() { | 2121 void LayerTreeImpl::ResetAllChangeTracking() { |
2122 layers_that_should_push_properties_.clear(); | 2122 layers_that_should_push_properties_.clear(); |
2123 // Iterate over all layers, including masks. | 2123 // Iterate over all layers, including masks. |
2124 for (auto& layer : *layers_) | 2124 for (auto& layer : *layers_) |
2125 layer->ResetChangeTracking(); | 2125 layer->ResetChangeTracking(); |
2126 property_trees_.ResetAllChangeTracking(); | 2126 property_trees_.ResetAllChangeTracking(); |
2127 } | 2127 } |
2128 | 2128 |
2129 } // namespace cc | 2129 } // namespace cc |
OLD | NEW |