| 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_LAYER_ITERATOR_H_ | 5 #ifndef CC_LAYER_ITERATOR_H_ |
| 6 #define CC_LAYER_ITERATOR_H_ | 6 #define CC_LAYER_ITERATOR_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "cc/cc_export.h" | 9 #include "cc/cc_export.h" |
| 10 #include "cc/layer_tree_host_common.h" | 10 #include "cc/layer_tree_host_common.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 position.currentLayer = currentLayer(); | 117 position.currentLayer = currentLayer(); |
| 118 return position; | 118 return position; |
| 119 } | 119 } |
| 120 | 120 |
| 121 private: | 121 private: |
| 122 LayerIterator(const LayerList* renderSurfaceLayerList, bool start) | 122 LayerIterator(const LayerList* renderSurfaceLayerList, bool start) |
| 123 : m_renderSurfaceLayerList(renderSurfaceLayerList) | 123 : m_renderSurfaceLayerList(renderSurfaceLayerList) |
| 124 , m_targetRenderSurfaceLayerIndex(0) | 124 , m_targetRenderSurfaceLayerIndex(0) |
| 125 { | 125 { |
| 126 for (size_t i = 0; i < renderSurfaceLayerList->size(); ++i) { | 126 for (size_t i = 0; i < renderSurfaceLayerList->size(); ++i) { |
| 127 if (!(*renderSurfaceLayerList)[i]->renderSurface()) { | 127 if (!(*renderSurfaceLayerList)[i]->render_surface()) { |
| 128 NOTREACHED(); | 128 NOTREACHED(); |
| 129 m_actions.end(*this); | 129 m_actions.end(*this); |
| 130 return; | 130 return; |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 | 133 |
| 134 if (start && !renderSurfaceLayerList->empty()) | 134 if (start && !renderSurfaceLayerList->empty()) |
| 135 m_actions.begin(*this); | 135 m_actions.begin(*this); |
| 136 else | 136 else |
| 137 m_actions.end(*this); | 137 m_actions.end(*this); |
| 138 } | 138 } |
| 139 | 139 |
| 140 inline static Layer* getRawPtr(const scoped_refptr<Layer>& ptr) { return ptr
.get(); } | 140 inline static Layer* getRawPtr(const scoped_refptr<Layer>& ptr) { return ptr
.get(); } |
| 141 inline static LayerImpl* getRawPtr(LayerImpl* ptr) { return ptr; } | 141 inline static LayerImpl* getRawPtr(LayerImpl* ptr) { return ptr; } |
| 142 | 142 |
| 143 inline LayerType* currentLayer() const { return currentLayerRepresentsTarget
RenderSurface() ? targetRenderSurfaceLayer() : getRawPtr(targetRenderSurfaceChil
dren()[m_currentLayerIndex]); } | 143 inline LayerType* currentLayer() const { return currentLayerRepresentsTarget
RenderSurface() ? targetRenderSurfaceLayer() : getRawPtr(targetRenderSurfaceChil
dren()[m_currentLayerIndex]); } |
| 144 | 144 |
| 145 inline bool currentLayerRepresentsContributingRenderSurface() const { return
LayerTreeHostCommon::renderSurfaceContributesToTarget<LayerType>(currentLayer()
, targetRenderSurfaceLayer()->id()); } | 145 inline bool currentLayerRepresentsContributingRenderSurface() const { return
LayerTreeHostCommon::renderSurfaceContributesToTarget<LayerType>(currentLayer()
, targetRenderSurfaceLayer()->id()); } |
| 146 inline bool currentLayerRepresentsTargetRenderSurface() const { return m_cur
rentLayerIndex == LayerIteratorValue::LayerIndexRepresentingTargetRenderSurface;
} | 146 inline bool currentLayerRepresentsTargetRenderSurface() const { return m_cur
rentLayerIndex == LayerIteratorValue::LayerIndexRepresentingTargetRenderSurface;
} |
| 147 | 147 |
| 148 inline RenderSurfaceType* targetRenderSurface() const { return targetRenderS
urfaceLayer()->renderSurface(); } | 148 inline RenderSurfaceType* targetRenderSurface() const { return targetRenderS
urfaceLayer()->render_surface(); } |
| 149 inline const LayerList& targetRenderSurfaceChildren() const { return targetR
enderSurface()->layer_list(); } | 149 inline const LayerList& targetRenderSurfaceChildren() const { return targetR
enderSurface()->layer_list(); } |
| 150 | 150 |
| 151 IteratorActionType m_actions; | 151 IteratorActionType m_actions; |
| 152 const LayerList* m_renderSurfaceLayerList; | 152 const LayerList* m_renderSurfaceLayerList; |
| 153 | 153 |
| 154 // The iterator's current position. | 154 // The iterator's current position. |
| 155 | 155 |
| 156 // A position in the renderSurfaceLayerList. This points to a layer which ow
ns the current target surface. | 156 // A position in the renderSurfaceLayerList. This points to a layer which ow
ns the current target surface. |
| 157 // This is a value from 0 to n-1 (n = size of renderSurfaceLayerList = numbe
r of surfaces). A value outside of | 157 // This is a value from 0 to n-1 (n = size of renderSurfaceLayerList = numbe
r of surfaces). A value outside of |
| 158 // this range (for example, LayerIteratorValue::InvalidTargetRenderSurfaceLa
yerIndex) is used to | 158 // this range (for example, LayerIteratorValue::InvalidTargetRenderSurfaceLa
yerIndex) is used to |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 199 |
| 200 private: | 200 private: |
| 201 template <typename LayerType, typename LayerList, typename RenderSurface
Type, typename ActionType> | 201 template <typename LayerType, typename LayerList, typename RenderSurface
Type, typename ActionType> |
| 202 void goToHighestInSubtree(LayerIterator<LayerType, LayerList, RenderSurf
aceType, ActionType>&); | 202 void goToHighestInSubtree(LayerIterator<LayerType, LayerList, RenderSurf
aceType, ActionType>&); |
| 203 }; | 203 }; |
| 204 }; | 204 }; |
| 205 | 205 |
| 206 } // namespace cc | 206 } // namespace cc |
| 207 | 207 |
| 208 #endif // CC_LAYER_ITERATOR_H_ | 208 #endif // CC_LAYER_ITERATOR_H_ |
| OLD | NEW |