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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
584 DCHECK(!is_root); | 584 DCHECK(!is_root); |
585 return true; | 585 return true; |
586 } | 586 } |
587 | 587 |
588 // If the layer uses a CSS filter. | 588 // If the layer uses a CSS filter. |
589 if (!layer->filters().IsEmpty() || !layer->background_filters().IsEmpty()) { | 589 if (!layer->filters().IsEmpty() || !layer->background_filters().IsEmpty()) { |
590 DCHECK(!is_root); | 590 DCHECK(!is_root); |
591 return true; | 591 return true; |
592 } | 592 } |
593 | 593 |
594 // If the layer will use a CSS filter. In this case, the animation | |
595 // will start and add a filter to this layer, so it needs a surface. | |
596 if (layer->FilterIsAnimating()) { | |
597 DCHECK(!is_root); | |
598 return true; | |
599 } | |
600 | |
594 int num_descendants_that_draw_content = | 601 int num_descendants_that_draw_content = |
595 layer->NumDescendantsThatDrawContent(); | 602 layer->NumDescendantsThatDrawContent(); |
596 | 603 |
597 // If the layer flattens its subtree, but it is treated as a 3D object by its | 604 // If the layer flattens its subtree, but it is treated as a 3D object by its |
598 // parent (i.e. parent participates in a 3D rendering context). | 605 // parent (i.e. parent participates in a 3D rendering context). |
599 if (LayerIsInExisting3DRenderingContext(layer) && | 606 if (LayerIsInExisting3DRenderingContext(layer) && |
600 layer->should_flatten_transform() && | 607 layer->should_flatten_transform() && |
601 num_descendants_that_draw_content > 0) { | 608 num_descendants_that_draw_content > 0) { |
602 TRACE_EVENT_INSTANT0( | 609 TRACE_EVENT_INSTANT0( |
603 "cc", | 610 "cc", |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1191 void Merge(const PreCalculateMetaInformationRecursiveData& data) { | 1198 void Merge(const PreCalculateMetaInformationRecursiveData& data) { |
1192 layer_or_descendant_has_copy_request |= | 1199 layer_or_descendant_has_copy_request |= |
1193 data.layer_or_descendant_has_copy_request; | 1200 data.layer_or_descendant_has_copy_request; |
1194 layer_or_descendant_has_input_handler |= | 1201 layer_or_descendant_has_input_handler |= |
1195 data.layer_or_descendant_has_input_handler; | 1202 data.layer_or_descendant_has_input_handler; |
1196 num_unclipped_descendants += | 1203 num_unclipped_descendants += |
1197 data.num_unclipped_descendants; | 1204 data.num_unclipped_descendants; |
1198 } | 1205 } |
1199 }; | 1206 }; |
1200 | 1207 |
1201 static bool ValidateRenderSurface(LayerImpl* layer) { | 1208 static void ValidateRenderSurface(LayerImpl* layer) { |
1202 // This test verifies that there are no cases where a LayerImpl needs | 1209 // This test verifies that there are no cases where a LayerImpl needs |
1203 // a render surface, but doesn't have one. | 1210 // a render surface, but doesn't have one. |
1204 if (layer->render_surface()) | 1211 if (layer->render_surface()) |
1205 return true; | 1212 return; |
1206 | 1213 |
1207 return layer->filters().IsEmpty() && layer->background_filters().IsEmpty() && | 1214 DCHECK(layer->filters().IsEmpty()) << "layer: " << layer->id(); |
1208 !layer->mask_layer() && !layer->replica_layer() && | 1215 DCHECK(layer->background_filters().IsEmpty()) << "layer: " << layer->id(); |
1209 !IsRootLayer(layer) && !layer->is_root_for_isolated_group() && | 1216 DCHECK(!layer->mask_layer()) << "layer: " << layer->id(); |
1210 !layer->HasCopyRequest(); | 1217 DCHECK(!layer->replica_layer()) << "layer: " << layer->id(); |
1218 DCHECK(!IsRootLayer(layer)) << "layer: " << layer->id(); | |
1219 DCHECK(!layer->is_root_for_isolated_group()) << "layer: " << layer->id(); | |
1220 DCHECK(!layer->HasCopyRequest()) << "layer: " << layer->id(); | |
Ian Vollick
2015/02/25 20:26:38
Ah nice - thanks! This'll give much better errors.
| |
1211 } | 1221 } |
1212 | 1222 |
1213 static bool ValidateRenderSurface(Layer* layer) { | 1223 static void ValidateRenderSurface(Layer* layer) { |
1214 return true; | |
1215 } | 1224 } |
1216 | 1225 |
1217 // Recursively walks the layer tree to compute any information that is needed | 1226 // Recursively walks the layer tree to compute any information that is needed |
1218 // before doing the main recursion. | 1227 // before doing the main recursion. |
1219 template <typename LayerType> | 1228 template <typename LayerType> |
1220 static void PreCalculateMetaInformation( | 1229 static void PreCalculateMetaInformation( |
1221 LayerType* layer, | 1230 LayerType* layer, |
1222 PreCalculateMetaInformationRecursiveData* recursive_data) { | 1231 PreCalculateMetaInformationRecursiveData* recursive_data) { |
1223 DCHECK(ValidateRenderSurface(layer)); | 1232 ValidateRenderSurface(layer); |
1224 | 1233 |
1225 layer->draw_properties().sorted_for_recursion = false; | 1234 layer->draw_properties().sorted_for_recursion = false; |
1226 layer->draw_properties().has_child_with_a_scroll_parent = false; | 1235 layer->draw_properties().has_child_with_a_scroll_parent = false; |
1227 layer->draw_properties().visited = false; | 1236 layer->draw_properties().visited = false; |
1228 | 1237 |
1229 if (!HasInvertibleOrAnimatedTransform(layer)) { | 1238 if (!HasInvertibleOrAnimatedTransform(layer)) { |
1230 // Layers with singular transforms should not be drawn, the whole subtree | 1239 // Layers with singular transforms should not be drawn, the whole subtree |
1231 // can be skipped. | 1240 // can be skipped. |
1232 return; | 1241 return; |
1233 } | 1242 } |
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2575 inputs->current_render_surface_layer_list_id); | 2584 inputs->current_render_surface_layer_list_id); |
2576 | 2585 |
2577 // The dummy layer list should not have been used. | 2586 // The dummy layer list should not have been used. |
2578 DCHECK_EQ(0u, dummy_layer_list.size()); | 2587 DCHECK_EQ(0u, dummy_layer_list.size()); |
2579 // A root layer render_surface should always exist after | 2588 // A root layer render_surface should always exist after |
2580 // CalculateDrawProperties. | 2589 // CalculateDrawProperties. |
2581 DCHECK(inputs->root_layer->render_surface()); | 2590 DCHECK(inputs->root_layer->render_surface()); |
2582 } | 2591 } |
2583 | 2592 |
2584 } // namespace cc | 2593 } // namespace cc |
OLD | NEW |