| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/property_tree_builder.h" | 5 #include "cc/trees/property_tree_builder.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 | 867 |
| 868 // If the layer has some translucency and does not have a preserves-3d | 868 // If the layer has some translucency and does not have a preserves-3d |
| 869 // transform style. This condition only needs a render surface if two or more | 869 // transform style. This condition only needs a render surface if two or more |
| 870 // layers in the subtree overlap. But checking layer overlaps is unnecessarily | 870 // layers in the subtree overlap. But checking layer overlaps is unnecessarily |
| 871 // costly so instead we conservatively create a surface whenever at least two | 871 // costly so instead we conservatively create a surface whenever at least two |
| 872 // layers draw content for this subtree. | 872 // layers draw content for this subtree. |
| 873 bool at_least_two_layers_in_subtree_draw_content = | 873 bool at_least_two_layers_in_subtree_draw_content = |
| 874 num_descendants_that_draw_content > 0 && | 874 num_descendants_that_draw_content > 0 && |
| 875 (layer->DrawsContent() || num_descendants_that_draw_content > 1); | 875 (layer->DrawsContent() || num_descendants_that_draw_content > 1); |
| 876 | 876 |
| 877 if (EffectiveOpacity(layer) != 1.f && ShouldFlattenTransform(layer) && | 877 bool may_have_transparency = EffectiveOpacity(layer) != 1.f || |
| 878 HasPotentiallyRunningOpacityAnimation(layer); |
| 879 if (may_have_transparency && ShouldFlattenTransform(layer) && |
| 878 at_least_two_layers_in_subtree_draw_content) { | 880 at_least_two_layers_in_subtree_draw_content) { |
| 879 TRACE_EVENT_INSTANT0( | 881 TRACE_EVENT_INSTANT0( |
| 880 "cc", "PropertyTreeBuilder::ShouldCreateRenderSurface opacity", | 882 "cc", "PropertyTreeBuilder::ShouldCreateRenderSurface opacity", |
| 881 TRACE_EVENT_SCOPE_THREAD); | 883 TRACE_EVENT_SCOPE_THREAD); |
| 882 DCHECK(!is_root); | 884 DCHECK(!is_root); |
| 883 return true; | 885 return true; |
| 884 } | 886 } |
| 885 // If the layer has isolation. | 887 // If the layer has isolation. |
| 886 // TODO(rosca): to be optimized - create separate rendering surface only when | 888 // TODO(rosca): to be optimized - create separate rendering surface only when |
| 887 // the blending descendants might have access to the content behind this layer | 889 // the blending descendants might have access to the content behind this layer |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1439 color = SkColorSetA(color, 255); | 1441 color = SkColorSetA(color, 255); |
| 1440 BuildPropertyTreesTopLevelInternal( | 1442 BuildPropertyTreesTopLevelInternal( |
| 1441 root_layer, page_scale_layer, inner_viewport_scroll_layer, | 1443 root_layer, page_scale_layer, inner_viewport_scroll_layer, |
| 1442 outer_viewport_scroll_layer, overscroll_elasticity_layer, | 1444 outer_viewport_scroll_layer, overscroll_elasticity_layer, |
| 1443 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, | 1445 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, |
| 1444 device_transform, property_trees, color); | 1446 device_transform, property_trees, color); |
| 1445 property_trees->ResetCachedData(); | 1447 property_trees->ResetCachedData(); |
| 1446 } | 1448 } |
| 1447 | 1449 |
| 1448 } // namespace cc | 1450 } // namespace cc |
| OLD | NEW |