| 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_LAYER_TREE_HOST_COMMON_H_ | 5 #ifndef CC_LAYER_TREE_HOST_COMMON_H_ |
| 6 #define CC_LAYER_TREE_HOST_COMMON_H_ | 6 #define CC_LAYER_TREE_HOST_COMMON_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/scoped_ptr_vector.h" | 10 #include "cc/scoped_ptr_vector.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 bool LayerTreeHostCommon::renderSurfaceContributesToTarget(LayerType* layer, int
targetSurfaceLayerID) | 67 bool LayerTreeHostCommon::renderSurfaceContributesToTarget(LayerType* layer, int
targetSurfaceLayerID) |
| 68 { | 68 { |
| 69 // A layer will either contribute its own content, or its render surface's c
ontent, to | 69 // A layer will either contribute its own content, or its render surface's c
ontent, to |
| 70 // the target surface. The layer contributes its surface's content when both
the | 70 // the target surface. The layer contributes its surface's content when both
the |
| 71 // following are true: | 71 // following are true: |
| 72 // (1) The layer actually has a renderSurface, and | 72 // (1) The layer actually has a renderSurface, and |
| 73 // (2) The layer's renderSurface is not the same as the targetSurface. | 73 // (2) The layer's renderSurface is not the same as the targetSurface. |
| 74 // | 74 // |
| 75 // Otherwise, the layer just contributes itself to the target surface. | 75 // Otherwise, the layer just contributes itself to the target surface. |
| 76 | 76 |
| 77 return layer->renderSurface() && layer->id() != targetSurfaceLayerID; | 77 return layer->render_surface() && layer->id() != targetSurfaceLayerID; |
| 78 } | 78 } |
| 79 | 79 |
| 80 template<typename LayerType> | 80 template<typename LayerType> |
| 81 LayerType* LayerTreeHostCommon::findLayerInSubtree(LayerType* rootLayer, int lay
erId) | 81 LayerType* LayerTreeHostCommon::findLayerInSubtree(LayerType* rootLayer, int lay
erId) |
| 82 { | 82 { |
| 83 if (rootLayer->id() == layerId) | 83 if (rootLayer->id() == layerId) |
| 84 return rootLayer; | 84 return rootLayer; |
| 85 | 85 |
| 86 if (rootLayer->maskLayer() && rootLayer->maskLayer()->id() == layerId) | 86 if (rootLayer->mask_layer() && rootLayer->mask_layer()->id() == layerId) |
| 87 return rootLayer->maskLayer(); | 87 return rootLayer->mask_layer(); |
| 88 | 88 |
| 89 if (rootLayer->replicaLayer() && rootLayer->replicaLayer()->id() == layerId) | 89 if (rootLayer->replica_layer() && rootLayer->replica_layer()->id() == layerI
d) |
| 90 return rootLayer->replicaLayer(); | 90 return rootLayer->replica_layer(); |
| 91 | 91 |
| 92 for (size_t i = 0; i < rootLayer->children().size(); ++i) { | 92 for (size_t i = 0; i < rootLayer->children().size(); ++i) { |
| 93 if (LayerType* found = findLayerInSubtree(getChildAsRawPtr(rootLayer->ch
ildren(), i), layerId)) | 93 if (LayerType* found = findLayerInSubtree(getChildAsRawPtr(rootLayer->ch
ildren(), i), layerId)) |
| 94 return found; | 94 return found; |
| 95 } | 95 } |
| 96 return 0; | 96 return 0; |
| 97 } | 97 } |
| 98 | 98 |
| 99 template<class Function, typename LayerType> | 99 template<class Function, typename LayerType> |
| 100 void LayerTreeHostCommon::callFunctionForSubtree(LayerType* rootLayer) | 100 void LayerTreeHostCommon::callFunctionForSubtree(LayerType* rootLayer) |
| 101 { | 101 { |
| 102 Function()(rootLayer); | 102 Function()(rootLayer); |
| 103 | 103 |
| 104 if (LayerType* maskLayer = rootLayer->maskLayer()) | 104 if (LayerType* maskLayer = rootLayer->mask_layer()) |
| 105 Function()(maskLayer); | 105 Function()(maskLayer); |
| 106 if (LayerType* replicaLayer = rootLayer->replicaLayer()) { | 106 if (LayerType* replicaLayer = rootLayer->replica_layer()) { |
| 107 Function()(replicaLayer); | 107 Function()(replicaLayer); |
| 108 if (LayerType* maskLayer = replicaLayer->maskLayer()) | 108 if (LayerType* maskLayer = replicaLayer->mask_layer()) |
| 109 Function()(maskLayer); | 109 Function()(maskLayer); |
| 110 } | 110 } |
| 111 | 111 |
| 112 for (size_t i = 0; i < rootLayer->children().size(); ++i) | 112 for (size_t i = 0; i < rootLayer->children().size(); ++i) |
| 113 callFunctionForSubtree<Function>(getChildAsRawPtr(rootLayer->children(),
i)); | 113 callFunctionForSubtree<Function>(getChildAsRawPtr(rootLayer->children(),
i)); |
| 114 } | 114 } |
| 115 | 115 |
| 116 } // namespace cc | 116 } // namespace cc |
| 117 | 117 |
| 118 #endif // CC_LAYER_TREE_HOST_COMMON_H_ | 118 #endif // CC_LAYER_TREE_HOST_COMMON_H_ |
| OLD | NEW |