| 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 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1195 void Merge(const PreCalculateMetaInformationRecursiveData& data) { | 1195 void Merge(const PreCalculateMetaInformationRecursiveData& data) { |
| 1196 layer_or_descendant_has_copy_request |= | 1196 layer_or_descendant_has_copy_request |= |
| 1197 data.layer_or_descendant_has_copy_request; | 1197 data.layer_or_descendant_has_copy_request; |
| 1198 layer_or_descendant_has_input_handler |= | 1198 layer_or_descendant_has_input_handler |= |
| 1199 data.layer_or_descendant_has_input_handler; | 1199 data.layer_or_descendant_has_input_handler; |
| 1200 num_unclipped_descendants += | 1200 num_unclipped_descendants += |
| 1201 data.num_unclipped_descendants; | 1201 data.num_unclipped_descendants; |
| 1202 } | 1202 } |
| 1203 }; | 1203 }; |
| 1204 | 1204 |
| 1205 static bool ValidateRenderSurface(LayerImpl* layer) { | |
| 1206 // There are a few cases in which it is incorrect to not have a | |
| 1207 // render_surface. | |
| 1208 if (layer->render_surface()) | |
| 1209 return true; | |
| 1210 | |
| 1211 return layer->filters().IsEmpty() && layer->background_filters().IsEmpty() && | |
| 1212 !layer->mask_layer() && !layer->replica_layer() && | |
| 1213 !IsRootLayer(layer) && !layer->is_root_for_isolated_group() && | |
| 1214 !layer->HasCopyRequest(); | |
| 1215 } | |
| 1216 | |
| 1217 static bool ValidateRenderSurface(Layer* layer) { | |
| 1218 return true; | |
| 1219 } | |
| 1220 | |
| 1221 // Recursively walks the layer tree to compute any information that is needed | 1205 // Recursively walks the layer tree to compute any information that is needed |
| 1222 // before doing the main recursion. | 1206 // before doing the main recursion. |
| 1223 template <typename LayerType> | 1207 template <typename LayerType> |
| 1224 static void PreCalculateMetaInformation( | 1208 static void PreCalculateMetaInformation( |
| 1225 LayerType* layer, | 1209 LayerType* layer, |
| 1226 PreCalculateMetaInformationRecursiveData* recursive_data) { | 1210 PreCalculateMetaInformationRecursiveData* recursive_data) { |
| 1227 DCHECK(ValidateRenderSurface(layer)); | |
| 1228 | |
| 1229 layer->draw_properties().sorted_for_recursion = false; | 1211 layer->draw_properties().sorted_for_recursion = false; |
| 1230 layer->draw_properties().has_child_with_a_scroll_parent = false; | 1212 layer->draw_properties().has_child_with_a_scroll_parent = false; |
| 1231 | 1213 |
| 1232 if (!HasInvertibleOrAnimatedTransform(layer)) { | 1214 if (!HasInvertibleOrAnimatedTransform(layer)) { |
| 1233 // Layers with singular transforms should not be drawn, the whole subtree | 1215 // Layers with singular transforms should not be drawn, the whole subtree |
| 1234 // can be skipped. | 1216 // can be skipped. |
| 1235 return; | 1217 return; |
| 1236 } | 1218 } |
| 1237 | 1219 |
| 1238 if (layer->clip_parent()) | 1220 if (layer->clip_parent()) |
| (...skipping 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2573 inputs->current_render_surface_layer_list_id); | 2555 inputs->current_render_surface_layer_list_id); |
| 2574 | 2556 |
| 2575 // The dummy layer list should not have been used. | 2557 // The dummy layer list should not have been used. |
| 2576 DCHECK_EQ(0u, dummy_layer_list.size()); | 2558 DCHECK_EQ(0u, dummy_layer_list.size()); |
| 2577 // A root layer render_surface should always exist after | 2559 // A root layer render_surface should always exist after |
| 2578 // CalculateDrawProperties. | 2560 // CalculateDrawProperties. |
| 2579 DCHECK(inputs->root_layer->render_surface()); | 2561 DCHECK(inputs->root_layer->render_surface()); |
| 2580 } | 2562 } |
| 2581 | 2563 |
| 2582 } // namespace cc | 2564 } // namespace cc |
| OLD | NEW |