OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/property_tree_builder.h" | 5 #include "cc/trees/property_tree_builder.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 num_unclipped_descendants += data.num_unclipped_descendants; | 94 num_unclipped_descendants += data.num_unclipped_descendants; |
95 num_descendants_that_draw_content += data.num_descendants_that_draw_content; | 95 num_descendants_that_draw_content += data.num_descendants_that_draw_content; |
96 } | 96 } |
97 }; | 97 }; |
98 | 98 |
99 static inline bool IsRootLayer(const Layer* layer) { | 99 static inline bool IsRootLayer(const Layer* layer) { |
100 return !layer->parent(); | 100 return !layer->parent(); |
101 } | 101 } |
102 | 102 |
103 static bool IsMetaInformationRecomputationNeeded(Layer* layer) { | 103 static bool IsMetaInformationRecomputationNeeded(Layer* layer) { |
104 return layer->layer_tree_host()->needs_meta_info_recomputation(); | 104 return layer->GetLayerTree()->needs_meta_info_recomputation(); |
105 } | 105 } |
106 | 106 |
107 // Recursively walks the layer tree(if needed) to compute any information | 107 // Recursively walks the layer tree(if needed) to compute any information |
108 // that is needed before doing the main recursion. | 108 // that is needed before doing the main recursion. |
109 static void PreCalculateMetaInformationInternal( | 109 static void PreCalculateMetaInformationInternal( |
110 Layer* layer, | 110 Layer* layer, |
111 PreCalculateMetaInformationRecursiveData* recursive_data) { | 111 PreCalculateMetaInformationRecursiveData* recursive_data) { |
112 if (!IsMetaInformationRecomputationNeeded(layer)) { | 112 if (!IsMetaInformationRecomputationNeeded(layer)) { |
113 DCHECK(IsRootLayer(layer)); | 113 DCHECK(IsRootLayer(layer)); |
114 return; | 114 return; |
(...skipping 13 matching lines...) Expand all Loading... |
128 if (layer->clip_children()) { | 128 if (layer->clip_children()) { |
129 size_t num_clip_children = layer->clip_children()->size(); | 129 size_t num_clip_children = layer->clip_children()->size(); |
130 DCHECK_GE(recursive_data->num_unclipped_descendants, num_clip_children); | 130 DCHECK_GE(recursive_data->num_unclipped_descendants, num_clip_children); |
131 recursive_data->num_unclipped_descendants -= num_clip_children; | 131 recursive_data->num_unclipped_descendants -= num_clip_children; |
132 } | 132 } |
133 | 133 |
134 layer->set_num_unclipped_descendants( | 134 layer->set_num_unclipped_descendants( |
135 recursive_data->num_unclipped_descendants); | 135 recursive_data->num_unclipped_descendants); |
136 | 136 |
137 if (IsRootLayer(layer)) | 137 if (IsRootLayer(layer)) |
138 layer->layer_tree_host()->SetNeedsMetaInfoRecomputation(false); | 138 layer->GetLayerTree()->SetNeedsMetaInfoRecomputation(false); |
139 } | 139 } |
140 | 140 |
141 static void PreCalculateMetaInformationInternalForTesting( | 141 static void PreCalculateMetaInformationInternalForTesting( |
142 LayerImpl* layer, | 142 LayerImpl* layer, |
143 PreCalculateMetaInformationRecursiveData* recursive_data) { | 143 PreCalculateMetaInformationRecursiveData* recursive_data) { |
144 if (layer->test_properties()->clip_parent) | 144 if (layer->test_properties()->clip_parent) |
145 recursive_data->num_unclipped_descendants++; | 145 recursive_data->num_unclipped_descendants++; |
146 | 146 |
147 for (size_t i = 0; i < layer->test_properties()->children.size(); ++i) { | 147 for (size_t i = 0; i < layer->test_properties()->children.size(); ++i) { |
148 LayerImpl* child_layer = layer->test_properties()->children[i]; | 148 LayerImpl* child_layer = layer->test_properties()->children[i]; |
(...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1412 float device_scale_factor, | 1412 float device_scale_factor, |
1413 const gfx::Rect& viewport, | 1413 const gfx::Rect& viewport, |
1414 const gfx::Transform& device_transform, | 1414 const gfx::Transform& device_transform, |
1415 PropertyTrees* property_trees) { | 1415 PropertyTrees* property_trees) { |
1416 property_trees->is_main_thread = true; | 1416 property_trees->is_main_thread = true; |
1417 property_trees->is_active = false; | 1417 property_trees->is_active = false; |
1418 property_trees->verify_transform_tree_calculations = | 1418 property_trees->verify_transform_tree_calculations = |
1419 root_layer->layer_tree_host() | 1419 root_layer->layer_tree_host() |
1420 ->settings() | 1420 ->settings() |
1421 .verify_transform_tree_calculations; | 1421 .verify_transform_tree_calculations; |
1422 SkColor color = root_layer->layer_tree_host()->background_color(); | 1422 SkColor color = root_layer->GetLayerTree()->background_color(); |
1423 if (SkColorGetA(color) != 255) | 1423 if (SkColorGetA(color) != 255) |
1424 color = SkColorSetA(color, 255); | 1424 color = SkColorSetA(color, 255); |
1425 BuildPropertyTreesTopLevelInternal( | 1425 BuildPropertyTreesTopLevelInternal( |
1426 root_layer, page_scale_layer, inner_viewport_scroll_layer, | 1426 root_layer, page_scale_layer, inner_viewport_scroll_layer, |
1427 outer_viewport_scroll_layer, overscroll_elasticity_layer, | 1427 outer_viewport_scroll_layer, overscroll_elasticity_layer, |
1428 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, | 1428 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, |
1429 device_transform, property_trees, color); | 1429 device_transform, property_trees, color); |
1430 #if DCHECK_IS_ON() | 1430 #if DCHECK_IS_ON() |
1431 for (auto* layer : *root_layer->layer_tree_host()) | 1431 for (auto* layer : *root_layer->layer_tree_host()) |
1432 CheckScrollAndClipPointersForLayer(layer); | 1432 CheckScrollAndClipPointersForLayer(layer); |
(...skipping 24 matching lines...) Expand all Loading... |
1457 color = SkColorSetA(color, 255); | 1457 color = SkColorSetA(color, 255); |
1458 BuildPropertyTreesTopLevelInternal( | 1458 BuildPropertyTreesTopLevelInternal( |
1459 root_layer, page_scale_layer, inner_viewport_scroll_layer, | 1459 root_layer, page_scale_layer, inner_viewport_scroll_layer, |
1460 outer_viewport_scroll_layer, overscroll_elasticity_layer, | 1460 outer_viewport_scroll_layer, overscroll_elasticity_layer, |
1461 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, | 1461 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, |
1462 device_transform, property_trees, color); | 1462 device_transform, property_trees, color); |
1463 property_trees->ResetCachedData(); | 1463 property_trees->ResetCachedData(); |
1464 } | 1464 } |
1465 | 1465 |
1466 } // namespace cc | 1466 } // namespace cc |
OLD | NEW |