| 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 <limits> | 8 #include <limits> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 // | 158 // |
| 159 // Otherwise, the layer just contributes itself to the target surface. | 159 // Otherwise, the layer just contributes itself to the target surface. |
| 160 | 160 |
| 161 return layer->render_surface() && layer->id() != target_surface_layer_id; | 161 return layer->render_surface() && layer->id() != target_surface_layer_id; |
| 162 } | 162 } |
| 163 | 163 |
| 164 template <typename LayerType> | 164 template <typename LayerType> |
| 165 LayerType* LayerTreeHostCommon::FindLayerInSubtree(LayerType* root_layer, | 165 LayerType* LayerTreeHostCommon::FindLayerInSubtree(LayerType* root_layer, |
| 166 int layer_id) { | 166 int layer_id) { |
| 167 if (!root_layer) | 167 if (!root_layer) |
| 168 return NULL; | 168 return nullptr; |
| 169 | 169 |
| 170 if (root_layer->id() == layer_id) | 170 if (root_layer->id() == layer_id) |
| 171 return root_layer; | 171 return root_layer; |
| 172 | 172 |
| 173 if (root_layer->mask_layer() && root_layer->mask_layer()->id() == layer_id) | 173 if (root_layer->mask_layer() && root_layer->mask_layer()->id() == layer_id) |
| 174 return root_layer->mask_layer(); | 174 return root_layer->mask_layer(); |
| 175 | 175 |
| 176 if (root_layer->replica_layer() && | 176 if (root_layer->replica_layer() && |
| 177 root_layer->replica_layer()->id() == layer_id) | 177 root_layer->replica_layer()->id() == layer_id) |
| 178 return root_layer->replica_layer(); | 178 return root_layer->replica_layer(); |
| 179 | 179 |
| 180 for (size_t i = 0; i < root_layer->children().size(); ++i) { | 180 for (size_t i = 0; i < root_layer->children().size(); ++i) { |
| 181 if (LayerType* found = FindLayerInSubtree( | 181 if (LayerType* found = FindLayerInSubtree( |
| 182 get_layer_as_raw_ptr(root_layer->children(), i), layer_id)) | 182 get_layer_as_raw_ptr(root_layer->children(), i), layer_id)) |
| 183 return found; | 183 return found; |
| 184 } | 184 } |
| 185 return NULL; | 185 return nullptr; |
| 186 } | 186 } |
| 187 | 187 |
| 188 template <typename LayerType> | 188 template <typename LayerType> |
| 189 void LayerTreeHostCommon::CallFunctionForSubtree( | 189 void LayerTreeHostCommon::CallFunctionForSubtree( |
| 190 LayerType* root_layer, | 190 LayerType* root_layer, |
| 191 const base::Callback<void(LayerType* layer)>& function) { | 191 const base::Callback<void(LayerType* layer)>& function) { |
| 192 function.Run(root_layer); | 192 function.Run(root_layer); |
| 193 | 193 |
| 194 if (LayerType* mask_layer = root_layer->mask_layer()) | 194 if (LayerType* mask_layer = root_layer->mask_layer()) |
| 195 function.Run(mask_layer); | 195 function.Run(mask_layer); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 212 LayerType* root_layer, | 212 LayerType* root_layer, |
| 213 const gfx::Size& device_viewport_size, | 213 const gfx::Size& device_viewport_size, |
| 214 const gfx::Transform& device_transform, | 214 const gfx::Transform& device_transform, |
| 215 RenderSurfaceLayerListType* render_surface_layer_list) | 215 RenderSurfaceLayerListType* render_surface_layer_list) |
| 216 : CalcDrawPropsInputs<LayerType, RenderSurfaceLayerListType>( | 216 : CalcDrawPropsInputs<LayerType, RenderSurfaceLayerListType>( |
| 217 root_layer, | 217 root_layer, |
| 218 device_viewport_size, | 218 device_viewport_size, |
| 219 device_transform, | 219 device_transform, |
| 220 1.f, | 220 1.f, |
| 221 1.f, | 221 1.f, |
| 222 NULL, | 222 nullptr, |
| 223 std::numeric_limits<int>::max() / 2, | 223 std::numeric_limits<int>::max() / 2, |
| 224 false, | 224 false, |
| 225 true, | 225 true, |
| 226 false, | 226 false, |
| 227 render_surface_layer_list, | 227 render_surface_layer_list, |
| 228 0) { | 228 0) { |
| 229 DCHECK(root_layer); | 229 DCHECK(root_layer); |
| 230 DCHECK(render_surface_layer_list); | 230 DCHECK(render_surface_layer_list); |
| 231 } | 231 } |
| 232 | 232 |
| 233 template <typename LayerType, typename RenderSurfaceLayerListType> | 233 template <typename LayerType, typename RenderSurfaceLayerListType> |
| 234 LayerTreeHostCommon::CalcDrawPropsInputsForTesting<LayerType, | 234 LayerTreeHostCommon::CalcDrawPropsInputsForTesting<LayerType, |
| 235 RenderSurfaceLayerListType>:: | 235 RenderSurfaceLayerListType>:: |
| 236 CalcDrawPropsInputsForTesting( | 236 CalcDrawPropsInputsForTesting( |
| 237 LayerType* root_layer, | 237 LayerType* root_layer, |
| 238 const gfx::Size& device_viewport_size, | 238 const gfx::Size& device_viewport_size, |
| 239 RenderSurfaceLayerListType* render_surface_layer_list) | 239 RenderSurfaceLayerListType* render_surface_layer_list) |
| 240 : CalcDrawPropsInputs<LayerType, RenderSurfaceLayerListType>( | 240 : CalcDrawPropsInputs<LayerType, RenderSurfaceLayerListType>( |
| 241 root_layer, | 241 root_layer, |
| 242 device_viewport_size, | 242 device_viewport_size, |
| 243 identity_transform_, | 243 identity_transform_, |
| 244 1.f, | 244 1.f, |
| 245 1.f, | 245 1.f, |
| 246 NULL, | 246 nullptr, |
| 247 std::numeric_limits<int>::max() / 2, | 247 std::numeric_limits<int>::max() / 2, |
| 248 false, | 248 false, |
| 249 true, | 249 true, |
| 250 false, | 250 false, |
| 251 render_surface_layer_list, | 251 render_surface_layer_list, |
| 252 0) { | 252 0) { |
| 253 DCHECK(root_layer); | 253 DCHECK(root_layer); |
| 254 DCHECK(render_surface_layer_list); | 254 DCHECK(render_surface_layer_list); |
| 255 } | 255 } |
| 256 | 256 |
| 257 } // namespace cc | 257 } // namespace cc |
| 258 | 258 |
| 259 #endif // CC_TREES_LAYER_TREE_HOST_COMMON_H_ | 259 #endif // CC_TREES_LAYER_TREE_HOST_COMMON_H_ |
| OLD | NEW |