| 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 #ifndef CC_TREES_LAYER_TREE_HOST_COMMON_H_ | 5 #ifndef CC_TREES_LAYER_TREE_HOST_COMMON_H_ |
| 6 #define CC_TREES_LAYER_TREE_HOST_COMMON_H_ | 6 #define CC_TREES_LAYER_TREE_HOST_COMMON_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "cc/base/cc_export.h" | 9 #include "cc/base/cc_export.h" |
| 10 #include "cc/base/scoped_ptr_vector.h" | 10 #include "cc/base/scoped_ptr_vector.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 float page_scale_delta; | 91 float page_scale_delta; |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 template <typename LayerType> | 94 template <typename LayerType> |
| 95 bool LayerTreeHostCommon::RenderSurfaceContributesToTarget( | 95 bool LayerTreeHostCommon::RenderSurfaceContributesToTarget( |
| 96 LayerType* layer, | 96 LayerType* layer, |
| 97 int target_surface_layer_id) { | 97 int target_surface_layer_id) { |
| 98 // A layer will either contribute its own content, or its render surface's | 98 // A layer will either contribute its own content, or its render surface's |
| 99 // content, to the target surface. The layer contributes its surface's content | 99 // content, to the target surface. The layer contributes its surface's content |
| 100 // when both the following are true: | 100 // when both the following are true: |
| 101 // (1) The layer actually has a renderSurface, and | 101 // (1) The layer actually has a render surface, and |
| 102 // (2) The layer's renderSurface is not the same as the targetSurface. | 102 // (2) The layer's render surface is not the same as the target surface. |
| 103 // | 103 // |
| 104 // Otherwise, the layer just contributes itself to the target surface. | 104 // Otherwise, the layer just contributes itself to the target surface. |
| 105 | 105 |
| 106 return layer->render_surface() && layer->id() != target_surface_layer_id; | 106 return layer->render_surface() && layer->id() != target_surface_layer_id; |
| 107 } | 107 } |
| 108 | 108 |
| 109 template <typename LayerType> | 109 template <typename LayerType> |
| 110 LayerType* LayerTreeHostCommon::FindLayerInSubtree(LayerType* root_layer, | 110 LayerType* LayerTreeHostCommon::FindLayerInSubtree(LayerType* root_layer, |
| 111 int layer_id) { | 111 int layer_id) { |
| 112 if (root_layer->id() == layer_id) | 112 if (root_layer->id() == layer_id) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 124 get_child_as_raw_ptr(root_layer->children(), i), layer_id)) | 124 get_child_as_raw_ptr(root_layer->children(), i), layer_id)) |
| 125 return found; | 125 return found; |
| 126 } | 126 } |
| 127 return NULL; | 127 return NULL; |
| 128 } | 128 } |
| 129 | 129 |
| 130 template <class Function, typename LayerType> | 130 template <class Function, typename LayerType> |
| 131 void LayerTreeHostCommon::CallFunctionForSubtree(LayerType* root_layer) { | 131 void LayerTreeHostCommon::CallFunctionForSubtree(LayerType* root_layer) { |
| 132 Function()(root_layer); | 132 Function()(root_layer); |
| 133 | 133 |
| 134 if (LayerType* maskLayer = root_layer->mask_layer()) | 134 if (LayerType* mask_layer = root_layer->mask_layer()) |
| 135 Function()(maskLayer); | 135 Function()(mask_layer); |
| 136 if (LayerType* replicaLayer = root_layer->replica_layer()) { | 136 if (LayerType* replica_layer = root_layer->replica_layer()) { |
| 137 Function()(replicaLayer); | 137 Function()(replica_layer); |
| 138 if (LayerType* maskLayer = replicaLayer->mask_layer()) | 138 if (LayerType* mask_layer = replica_layer->mask_layer()) |
| 139 Function()(maskLayer); | 139 Function()(mask_layer); |
| 140 } | 140 } |
| 141 | 141 |
| 142 for (size_t i = 0; i < root_layer->children().size(); ++i) { | 142 for (size_t i = 0; i < root_layer->children().size(); ++i) { |
| 143 CallFunctionForSubtree<Function>( | 143 CallFunctionForSubtree<Function>( |
| 144 get_child_as_raw_ptr(root_layer->children(), i)); | 144 get_child_as_raw_ptr(root_layer->children(), i)); |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 | 147 |
| 148 } // namespace cc | 148 } // namespace cc |
| 149 | 149 |
| 150 #endif // CC_TREES_LAYER_TREE_HOST_COMMON_H_ | 150 #endif // CC_TREES_LAYER_TREE_HOST_COMMON_H_ |
| OLD | NEW |