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