| 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 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1419 float device_scale_factor, | 1419 float device_scale_factor, |
| 1420 const gfx::Rect& viewport, | 1420 const gfx::Rect& viewport, |
| 1421 const gfx::Transform& device_transform, | 1421 const gfx::Transform& device_transform, |
| 1422 PropertyTrees* property_trees) { | 1422 PropertyTrees* property_trees) { |
| 1423 property_trees->is_main_thread = true; | 1423 property_trees->is_main_thread = true; |
| 1424 property_trees->is_active = false; | 1424 property_trees->is_active = false; |
| 1425 property_trees->verify_transform_tree_calculations = | 1425 property_trees->verify_transform_tree_calculations = |
| 1426 root_layer->layer_tree_host() | 1426 root_layer->layer_tree_host() |
| 1427 ->settings() | 1427 ->settings() |
| 1428 .verify_transform_tree_calculations; | 1428 .verify_transform_tree_calculations; |
| 1429 SkColor color = root_layer->layer_tree_host()->background_color(); | 1429 SkColor color = root_layer->GetLayerTree()->background_color(); |
| 1430 if (SkColorGetA(color) != 255) | 1430 if (SkColorGetA(color) != 255) |
| 1431 color = SkColorSetA(color, 255); | 1431 color = SkColorSetA(color, 255); |
| 1432 BuildPropertyTreesTopLevelInternal( | 1432 BuildPropertyTreesTopLevelInternal( |
| 1433 root_layer, page_scale_layer, inner_viewport_scroll_layer, | 1433 root_layer, page_scale_layer, inner_viewport_scroll_layer, |
| 1434 outer_viewport_scroll_layer, overscroll_elasticity_layer, | 1434 outer_viewport_scroll_layer, overscroll_elasticity_layer, |
| 1435 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, | 1435 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, |
| 1436 device_transform, property_trees, color); | 1436 device_transform, property_trees, color); |
| 1437 #if DCHECK_IS_ON() | 1437 #if DCHECK_IS_ON() |
| 1438 for (auto* layer : *root_layer->layer_tree_host()) | 1438 for (auto* layer : *root_layer->layer_tree_host()) |
| 1439 CheckScrollAndClipPointersForLayer(layer); | 1439 CheckScrollAndClipPointersForLayer(layer); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1464 color = SkColorSetA(color, 255); | 1464 color = SkColorSetA(color, 255); |
| 1465 BuildPropertyTreesTopLevelInternal( | 1465 BuildPropertyTreesTopLevelInternal( |
| 1466 root_layer, page_scale_layer, inner_viewport_scroll_layer, | 1466 root_layer, page_scale_layer, inner_viewport_scroll_layer, |
| 1467 outer_viewport_scroll_layer, overscroll_elasticity_layer, | 1467 outer_viewport_scroll_layer, overscroll_elasticity_layer, |
| 1468 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, | 1468 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, |
| 1469 device_transform, property_trees, color); | 1469 device_transform, property_trees, color); |
| 1470 property_trees->ResetCachedData(); | 1470 property_trees->ResetCachedData(); |
| 1471 } | 1471 } |
| 1472 | 1472 |
| 1473 } // namespace cc | 1473 } // namespace cc |
| OLD | NEW |