Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(803)

Side by Side Diff: cc/layer_tree_host_common.h

Issue 12774006: cc: Chromify Layer and LayerImpl classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: MoreAndroidCompilings Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layer_tree_host.cc ('k') | cc/layer_tree_host_common.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_
OLDNEW
« no previous file with comments | « cc/layer_tree_host.cc ('k') | cc/layer_tree_host_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698