OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_LAYERS_LAYER_ITERATOR_H_ | 5 #ifndef CC_LAYERS_LAYER_ITERATOR_H_ |
6 #define CC_LAYERS_LAYER_ITERATOR_H_ | 6 #define CC_LAYERS_LAYER_ITERATOR_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 position.target_render_surface_layer = target_render_surface_layer(); | 157 position.target_render_surface_layer = target_render_surface_layer(); |
158 position.current_layer = current_layer(); | 158 position.current_layer = current_layer(); |
159 return position; | 159 return position; |
160 } | 160 } |
161 | 161 |
162 private: | 162 private: |
163 LayerIterator(const LayerImplList* render_surface_layer_list, bool start) | 163 LayerIterator(const LayerImplList* render_surface_layer_list, bool start) |
164 : render_surface_layer_list_(render_surface_layer_list), | 164 : render_surface_layer_list_(render_surface_layer_list), |
165 target_render_surface_layer_index_(0) { | 165 target_render_surface_layer_index_(0) { |
166 for (size_t i = 0; i < render_surface_layer_list->size(); ++i) { | 166 for (size_t i = 0; i < render_surface_layer_list->size(); ++i) { |
167 if (!render_surface_layer_list->at(i)->render_surface()) { | 167 if (!render_surface_layer_list->at(i)->GetRenderSurface()) { |
168 NOTREACHED(); | 168 NOTREACHED(); |
169 MoveToEnd(); | 169 MoveToEnd(); |
170 return; | 170 return; |
171 } | 171 } |
172 } | 172 } |
173 | 173 |
174 if (start && !render_surface_layer_list->empty()) | 174 if (start && !render_surface_layer_list->empty()) |
175 MoveToBegin(); | 175 MoveToBegin(); |
176 else | 176 else |
177 MoveToEnd(); | 177 MoveToEnd(); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 } | 243 } |
244 } | 244 } |
245 | 245 |
246 inline LayerImpl* current_layer() const { | 246 inline LayerImpl* current_layer() const { |
247 return current_layer_represents_target_render_surface() | 247 return current_layer_represents_target_render_surface() |
248 ? target_render_surface_layer() | 248 ? target_render_surface_layer() |
249 : target_render_surface_children().at(current_layer_index_); | 249 : target_render_surface_children().at(current_layer_index_); |
250 } | 250 } |
251 | 251 |
252 inline bool current_layer_represents_contributing_render_surface() const { | 252 inline bool current_layer_represents_contributing_render_surface() const { |
253 RenderSurfaceImpl* render_surface = current_layer()->render_surface(); | 253 RenderSurfaceImpl* render_surface = current_layer()->GetRenderSurface(); |
254 return render_surface && render_surface != target_render_surface(); | 254 return render_surface && render_surface != target_render_surface(); |
255 } | 255 } |
256 inline bool current_layer_represents_target_render_surface() const { | 256 inline bool current_layer_represents_target_render_surface() const { |
257 return current_layer_index_ == | 257 return current_layer_index_ == |
258 LayerIteratorValue::kLayerIndexRepresentingTargetRenderSurface; | 258 LayerIteratorValue::kLayerIndexRepresentingTargetRenderSurface; |
259 } | 259 } |
260 | 260 |
261 inline RenderSurfaceImpl* target_render_surface() const { | 261 inline RenderSurfaceImpl* target_render_surface() const { |
262 return target_render_surface_layer()->render_surface(); | 262 return target_render_surface_layer()->GetRenderSurface(); |
263 } | 263 } |
264 inline const LayerImplList& target_render_surface_children() const { | 264 inline const LayerImplList& target_render_surface_children() const { |
265 return target_render_surface()->layer_list(); | 265 return target_render_surface()->layer_list(); |
266 } | 266 } |
267 | 267 |
268 const LayerImplList* render_surface_layer_list_; | 268 const LayerImplList* render_surface_layer_list_; |
269 | 269 |
270 // The iterator's current position. | 270 // The iterator's current position. |
271 | 271 |
272 // A position in the render_surface_layer_list. This points to a layer which | 272 // A position in the render_surface_layer_list. This points to a layer which |
273 // owns the current target surface. This is a value from 0 to n-1 | 273 // owns the current target surface. This is a value from 0 to n-1 |
274 // (n = size of render_surface_layer_list = number of surfaces). | 274 // (n = size of render_surface_layer_list = number of surfaces). |
275 // A value outside of this range | 275 // A value outside of this range |
276 // (for example, LayerIteratorValue::kInvalidTargetRenderSurfaceLayerIndex) | 276 // (for example, LayerIteratorValue::kInvalidTargetRenderSurfaceLayerIndex) |
277 // is used to indicate a position outside the bounds of the tree. | 277 // is used to indicate a position outside the bounds of the tree. |
278 int target_render_surface_layer_index_; | 278 int target_render_surface_layer_index_; |
279 // A position in the list of layers that are children of the | 279 // A position in the list of layers that are children of the |
280 // current target surface. When pointing to one of these layers, | 280 // current target surface. When pointing to one of these layers, |
281 // this is a value from 0 to n-1 (n = number of children). | 281 // this is a value from 0 to n-1 (n = number of children). |
282 // Since the iterator must also stop at the layers representing | 282 // Since the iterator must also stop at the layers representing |
283 // the target surface, this is done by setting the current_layer_index | 283 // the target surface, this is done by setting the current_layer_index |
284 // to a value of | 284 // to a value of |
285 // LayerIteratorValue::kLayerIndexRepresentingTargetRenderSurface. | 285 // LayerIteratorValue::kLayerIndexRepresentingTargetRenderSurface. |
286 size_t current_layer_index_; | 286 size_t current_layer_index_; |
287 }; | 287 }; |
288 | 288 |
289 } // namespace cc | 289 } // namespace cc |
290 | 290 |
291 #endif // CC_LAYERS_LAYER_ITERATOR_H_ | 291 #endif // CC_LAYERS_LAYER_ITERATOR_H_ |
OLD | NEW |