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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 num_unclipped_descendants += data.num_unclipped_descendants; | 95 num_unclipped_descendants += data.num_unclipped_descendants; |
96 num_descendants_that_draw_content += data.num_descendants_that_draw_content; | 96 num_descendants_that_draw_content += data.num_descendants_that_draw_content; |
97 } | 97 } |
98 }; | 98 }; |
99 | 99 |
100 static inline bool IsRootLayer(const Layer* layer) { | 100 static inline bool IsRootLayer(const Layer* layer) { |
101 return !layer->parent(); | 101 return !layer->parent(); |
102 } | 102 } |
103 | 103 |
104 static bool IsMetaInformationRecomputationNeeded(Layer* layer) { | 104 static bool IsMetaInformationRecomputationNeeded(Layer* layer) { |
105 return layer->layer_tree_host()->needs_meta_info_recomputation(); | 105 return layer->GetLayerTree()->needs_meta_info_recomputation(); |
106 } | 106 } |
107 | 107 |
108 // Recursively walks the layer tree(if needed) to compute any information | 108 // Recursively walks the layer tree(if needed) to compute any information |
109 // that is needed before doing the main recursion. | 109 // that is needed before doing the main recursion. |
110 static void PreCalculateMetaInformationInternal( | 110 static void PreCalculateMetaInformationInternal( |
111 Layer* layer, | 111 Layer* layer, |
112 PreCalculateMetaInformationRecursiveData* recursive_data) { | 112 PreCalculateMetaInformationRecursiveData* recursive_data) { |
113 if (!IsMetaInformationRecomputationNeeded(layer)) { | 113 if (!IsMetaInformationRecomputationNeeded(layer)) { |
114 DCHECK(IsRootLayer(layer)); | 114 DCHECK(IsRootLayer(layer)); |
115 return; | 115 return; |
(...skipping 13 matching lines...) Expand all Loading... |
129 if (layer->clip_children()) { | 129 if (layer->clip_children()) { |
130 size_t num_clip_children = layer->clip_children()->size(); | 130 size_t num_clip_children = layer->clip_children()->size(); |
131 DCHECK_GE(recursive_data->num_unclipped_descendants, num_clip_children); | 131 DCHECK_GE(recursive_data->num_unclipped_descendants, num_clip_children); |
132 recursive_data->num_unclipped_descendants -= num_clip_children; | 132 recursive_data->num_unclipped_descendants -= num_clip_children; |
133 } | 133 } |
134 | 134 |
135 layer->set_num_unclipped_descendants( | 135 layer->set_num_unclipped_descendants( |
136 recursive_data->num_unclipped_descendants); | 136 recursive_data->num_unclipped_descendants); |
137 | 137 |
138 if (IsRootLayer(layer)) | 138 if (IsRootLayer(layer)) |
139 layer->layer_tree_host()->SetNeedsMetaInfoRecomputation(false); | 139 layer->GetLayerTree()->SetNeedsMetaInfoRecomputation(false); |
140 } | 140 } |
141 | 141 |
142 static void PreCalculateMetaInformationInternalForTesting( | 142 static void PreCalculateMetaInformationInternalForTesting( |
143 LayerImpl* layer, | 143 LayerImpl* layer, |
144 PreCalculateMetaInformationRecursiveData* recursive_data) { | 144 PreCalculateMetaInformationRecursiveData* recursive_data) { |
145 if (layer->test_properties()->clip_parent) | 145 if (layer->test_properties()->clip_parent) |
146 recursive_data->num_unclipped_descendants++; | 146 recursive_data->num_unclipped_descendants++; |
147 | 147 |
148 for (size_t i = 0; i < layer->test_properties()->children.size(); ++i) { | 148 for (size_t i = 0; i < layer->test_properties()->children.size(); ++i) { |
149 LayerImpl* child_layer = layer->test_properties()->children[i]; | 149 LayerImpl* child_layer = layer->test_properties()->children[i]; |
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1428 float device_scale_factor, | 1428 float device_scale_factor, |
1429 const gfx::Rect& viewport, | 1429 const gfx::Rect& viewport, |
1430 const gfx::Transform& device_transform, | 1430 const gfx::Transform& device_transform, |
1431 PropertyTrees* property_trees) { | 1431 PropertyTrees* property_trees) { |
1432 property_trees->is_main_thread = true; | 1432 property_trees->is_main_thread = true; |
1433 property_trees->is_active = false; | 1433 property_trees->is_active = false; |
1434 property_trees->verify_transform_tree_calculations = | 1434 property_trees->verify_transform_tree_calculations = |
1435 root_layer->layer_tree_host() | 1435 root_layer->layer_tree_host() |
1436 ->settings() | 1436 ->settings() |
1437 .verify_transform_tree_calculations; | 1437 .verify_transform_tree_calculations; |
1438 SkColor color = root_layer->layer_tree_host()->background_color(); | 1438 SkColor color = root_layer->GetLayerTree()->background_color(); |
1439 if (SkColorGetA(color) != 255) | 1439 if (SkColorGetA(color) != 255) |
1440 color = SkColorSetA(color, 255); | 1440 color = SkColorSetA(color, 255); |
1441 BuildPropertyTreesTopLevelInternal( | 1441 BuildPropertyTreesTopLevelInternal( |
1442 root_layer, page_scale_layer, inner_viewport_scroll_layer, | 1442 root_layer, page_scale_layer, inner_viewport_scroll_layer, |
1443 outer_viewport_scroll_layer, overscroll_elasticity_layer, | 1443 outer_viewport_scroll_layer, overscroll_elasticity_layer, |
1444 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, | 1444 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, |
1445 device_transform, property_trees, color); | 1445 device_transform, property_trees, color); |
1446 #if DCHECK_IS_ON() | 1446 #if DCHECK_IS_ON() |
1447 for (auto* layer : *root_layer->layer_tree_host()) | 1447 for (auto* layer : *root_layer->layer_tree_host()) |
1448 CheckScrollAndClipPointersForLayer(layer); | 1448 CheckScrollAndClipPointersForLayer(layer); |
(...skipping 24 matching lines...) Expand all Loading... |
1473 color = SkColorSetA(color, 255); | 1473 color = SkColorSetA(color, 255); |
1474 BuildPropertyTreesTopLevelInternal( | 1474 BuildPropertyTreesTopLevelInternal( |
1475 root_layer, page_scale_layer, inner_viewport_scroll_layer, | 1475 root_layer, page_scale_layer, inner_viewport_scroll_layer, |
1476 outer_viewport_scroll_layer, overscroll_elasticity_layer, | 1476 outer_viewport_scroll_layer, overscroll_elasticity_layer, |
1477 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, | 1477 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, |
1478 device_transform, property_trees, color); | 1478 device_transform, property_trees, color); |
1479 property_trees->ResetCachedData(); | 1479 property_trees->ResetCachedData(); |
1480 } | 1480 } |
1481 | 1481 |
1482 } // namespace cc | 1482 } // namespace cc |
OLD | NEW |