Chromium Code Reviews| 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_TREES_LAYER_TREE_HOST_COMMON_H_ | 5 #ifndef CC_TREES_LAYER_TREE_HOST_COMMON_H_ |
| 6 #define CC_TREES_LAYER_TREE_HOST_COMMON_H_ | 6 #define CC_TREES_LAYER_TREE_HOST_COMMON_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 180 bool EqualsForTesting(const ScrollAndScaleSet& other) const; | 180 bool EqualsForTesting(const ScrollAndScaleSet& other) const; |
| 181 void ToProtobuf(proto::ScrollAndScaleSet* proto) const; | 181 void ToProtobuf(proto::ScrollAndScaleSet* proto) const; |
| 182 void FromProtobuf(const proto::ScrollAndScaleSet& proto); | 182 void FromProtobuf(const proto::ScrollAndScaleSet& proto); |
| 183 | 183 |
| 184 private: | 184 private: |
| 185 DISALLOW_COPY_AND_ASSIGN(ScrollAndScaleSet); | 185 DISALLOW_COPY_AND_ASSIGN(ScrollAndScaleSet); |
| 186 }; | 186 }; |
| 187 | 187 |
| 188 template <typename LayerType> | 188 template <typename LayerType> |
| 189 bool LayerTreeHostCommon::RenderSurfaceContributesToTarget( | 189 bool LayerTreeHostCommon::RenderSurfaceContributesToTarget( |
| 190 LayerType* layer, | 190 LayerType* layer, |
|
ajuma
2016/04/07 21:59:55
Note for future cleanup: this can be detemplatized
| |
| 191 int target_surface_layer_id) { | 191 int target_surface_layer_id) { |
| 192 // A layer will either contribute its own content, or its render surface's | 192 // A layer will either contribute its own content, or its render surface's |
| 193 // content, to the target surface. The layer contributes its surface's content | 193 // content, to the target surface. The layer contributes its surface's content |
| 194 // when both the following are true: | 194 // when both the following are true: |
| 195 // (1) The layer actually has a render surface and rendering into that | 195 // (1) The layer actually has a render surface and rendering into that |
| 196 // surface, and | 196 // surface, and |
| 197 // (2) The layer's render surface is not the same as the target surface. | 197 // (2) The layer's render surface is not the same as the target surface. |
| 198 // | 198 // |
| 199 // Otherwise, the layer just contributes itself to the target surface. | 199 // Otherwise, the layer just contributes itself to the target surface. |
| 200 | 200 |
| 201 return layer->render_target() == layer && | 201 return layer->has_render_surface() && |
| 202 layer->render_target() == layer->render_surface() && | |
| 202 layer->id() != target_surface_layer_id; | 203 layer->id() != target_surface_layer_id; |
| 203 } | 204 } |
| 204 | 205 |
| 205 template <typename LayerType, typename Function> | 206 template <typename LayerType, typename Function> |
| 206 static void CallFunctionForLayer(LayerType* layer, const Function& function) { | 207 static void CallFunctionForLayer(LayerType* layer, const Function& function) { |
| 207 function(layer); | 208 function(layer); |
| 208 | 209 |
| 209 if (LayerType* mask_layer = layer->mask_layer()) | 210 if (LayerType* mask_layer = layer->mask_layer()) |
| 210 function(mask_layer); | 211 function(mask_layer); |
| 211 if (LayerType* replica_layer = layer->replica_layer()) { | 212 if (LayerType* replica_layer = layer->replica_layer()) { |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 237 for (auto* layer : *host_impl) | 238 for (auto* layer : *host_impl) |
| 238 CallFunctionForLayer(layer, function); | 239 CallFunctionForLayer(layer, function); |
| 239 } | 240 } |
| 240 | 241 |
| 241 CC_EXPORT PropertyTrees* GetPropertyTrees(Layer* layer); | 242 CC_EXPORT PropertyTrees* GetPropertyTrees(Layer* layer); |
| 242 CC_EXPORT PropertyTrees* GetPropertyTrees(LayerImpl* layer); | 243 CC_EXPORT PropertyTrees* GetPropertyTrees(LayerImpl* layer); |
| 243 | 244 |
| 244 } // namespace cc | 245 } // namespace cc |
| 245 | 246 |
| 246 #endif // CC_TREES_LAYER_TREE_HOST_COMMON_H_ | 247 #endif // CC_TREES_LAYER_TREE_HOST_COMMON_H_ |
| OLD | NEW |