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 #include "cc/trees/layer_tree_host_common.h" | 5 #include "cc/trees/layer_tree_host_common.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1196 void Merge(const PreCalculateMetaInformationRecursiveData& data) { | 1196 void Merge(const PreCalculateMetaInformationRecursiveData& data) { |
1197 layer_or_descendant_has_copy_request |= | 1197 layer_or_descendant_has_copy_request |= |
1198 data.layer_or_descendant_has_copy_request; | 1198 data.layer_or_descendant_has_copy_request; |
1199 layer_or_descendant_has_input_handler |= | 1199 layer_or_descendant_has_input_handler |= |
1200 data.layer_or_descendant_has_input_handler; | 1200 data.layer_or_descendant_has_input_handler; |
1201 num_unclipped_descendants += | 1201 num_unclipped_descendants += |
1202 data.num_unclipped_descendants; | 1202 data.num_unclipped_descendants; |
1203 } | 1203 } |
1204 }; | 1204 }; |
1205 | 1205 |
| 1206 static bool ValidateRenderSurface(LayerImpl* layer) { |
| 1207 // This test verifies that there are no cases where a LayerImpl needs |
| 1208 // a render surface, but doesn't have one. |
| 1209 if (layer->render_surface()) |
| 1210 return true; |
| 1211 |
| 1212 return layer->filters().IsEmpty() && layer->background_filters().IsEmpty() && |
| 1213 !layer->mask_layer() && !layer->replica_layer() && |
| 1214 !IsRootLayer(layer) && !layer->is_root_for_isolated_group() && |
| 1215 !layer->HasCopyRequest(); |
| 1216 } |
| 1217 |
| 1218 static bool ValidateRenderSurface(Layer* layer) { |
| 1219 return true; |
| 1220 } |
| 1221 |
1206 // Recursively walks the layer tree to compute any information that is needed | 1222 // Recursively walks the layer tree to compute any information that is needed |
1207 // before doing the main recursion. | 1223 // before doing the main recursion. |
1208 template <typename LayerType> | 1224 template <typename LayerType> |
1209 static void PreCalculateMetaInformation( | 1225 static void PreCalculateMetaInformation( |
1210 LayerType* layer, | 1226 LayerType* layer, |
1211 PreCalculateMetaInformationRecursiveData* recursive_data) { | 1227 PreCalculateMetaInformationRecursiveData* recursive_data) { |
| 1228 DCHECK(ValidateRenderSurface(layer)); |
| 1229 |
1212 layer->draw_properties().sorted_for_recursion = false; | 1230 layer->draw_properties().sorted_for_recursion = false; |
1213 layer->draw_properties().has_child_with_a_scroll_parent = false; | 1231 layer->draw_properties().has_child_with_a_scroll_parent = false; |
1214 | 1232 |
1215 if (!HasInvertibleOrAnimatedTransform(layer)) { | 1233 if (!HasInvertibleOrAnimatedTransform(layer)) { |
1216 // Layers with singular transforms should not be drawn, the whole subtree | 1234 // Layers with singular transforms should not be drawn, the whole subtree |
1217 // can be skipped. | 1235 // can be skipped. |
1218 return; | 1236 return; |
1219 } | 1237 } |
1220 | 1238 |
1221 if (layer->clip_parent()) | 1239 if (layer->clip_parent()) |
(...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2558 inputs->current_render_surface_layer_list_id); | 2576 inputs->current_render_surface_layer_list_id); |
2559 | 2577 |
2560 // The dummy layer list should not have been used. | 2578 // The dummy layer list should not have been used. |
2561 DCHECK_EQ(0u, dummy_layer_list.size()); | 2579 DCHECK_EQ(0u, dummy_layer_list.size()); |
2562 // A root layer render_surface should always exist after | 2580 // A root layer render_surface should always exist after |
2563 // CalculateDrawProperties. | 2581 // CalculateDrawProperties. |
2564 DCHECK(inputs->root_layer->render_surface()); | 2582 DCHECK(inputs->root_layer->render_surface()); |
2565 } | 2583 } |
2566 | 2584 |
2567 } // namespace cc | 2585 } // namespace cc |
OLD | NEW |