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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 current_layer_index_ = target_render_surface_children().size() - 1; | 239 current_layer_index_ = target_render_surface_children().size() - 1; |
240 | 240 |
241 target_render_surface()->target_render_surface_layer_index_history_ = | 241 target_render_surface()->target_render_surface_layer_index_history_ = |
242 previous_target_render_surface_layer; | 242 previous_target_render_surface_layer; |
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 : LayerTreeHostCommon::get_layer_as_raw_ptr( | 249 : target_render_surface_children().at(current_layer_index_); |
250 target_render_surface_children(), current_layer_index_); | |
251 } | 250 } |
252 | 251 |
253 inline bool current_layer_represents_contributing_render_surface() const { | 252 inline bool current_layer_represents_contributing_render_surface() const { |
254 return LayerTreeHostCommon::RenderSurfaceContributesToTarget<LayerImpl>( | 253 return current_layer()->render_surface() && |
255 current_layer(), target_render_surface_layer()->id()); | 254 current_layer()->render_surface() != target_render_surface(); |
256 } | 255 } |
257 inline bool current_layer_represents_target_render_surface() const { | 256 inline bool current_layer_represents_target_render_surface() const { |
258 return current_layer_index_ == | 257 return current_layer_index_ == |
259 LayerIteratorValue::kLayerIndexRepresentingTargetRenderSurface; | 258 LayerIteratorValue::kLayerIndexRepresentingTargetRenderSurface; |
260 } | 259 } |
261 | 260 |
262 inline RenderSurfaceImpl* target_render_surface() const { | 261 inline RenderSurfaceImpl* target_render_surface() const { |
263 return target_render_surface_layer()->render_surface(); | 262 return target_render_surface_layer()->render_surface(); |
264 } | 263 } |
265 inline const LayerImplList& target_render_surface_children() const { | 264 inline const LayerImplList& target_render_surface_children() const { |
(...skipping 17 matching lines...) Expand all Loading... |
283 // Since the iterator must also stop at the layers representing | 282 // Since the iterator must also stop at the layers representing |
284 // 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 |
285 // to a value of | 284 // to a value of |
286 // LayerIteratorValue::kLayerIndexRepresentingTargetRenderSurface. | 285 // LayerIteratorValue::kLayerIndexRepresentingTargetRenderSurface. |
287 size_t current_layer_index_; | 286 size_t current_layer_index_; |
288 }; | 287 }; |
289 | 288 |
290 } // namespace cc | 289 } // namespace cc |
291 | 290 |
292 #endif // CC_LAYERS_LAYER_ITERATOR_H_ | 291 #endif // CC_LAYERS_LAYER_ITERATOR_H_ |
OLD | NEW |