| 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 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 } | 760 } |
| 761 | 761 |
| 762 static inline float Opacity(Layer* layer) { | 762 static inline float Opacity(Layer* layer) { |
| 763 return layer->opacity(); | 763 return layer->opacity(); |
| 764 } | 764 } |
| 765 | 765 |
| 766 static inline float Opacity(LayerImpl* layer) { | 766 static inline float Opacity(LayerImpl* layer) { |
| 767 return layer->test_properties()->opacity; | 767 return layer->test_properties()->opacity; |
| 768 } | 768 } |
| 769 | 769 |
| 770 static inline SkXfermode::Mode BlendMode(Layer* layer) { |
| 771 return layer->blend_mode(); |
| 772 } |
| 773 |
| 774 static inline SkXfermode::Mode BlendMode(LayerImpl* layer) { |
| 775 return layer->test_properties()->blend_mode; |
| 776 } |
| 777 |
| 770 static inline const FilterOperations& Filters(Layer* layer) { | 778 static inline const FilterOperations& Filters(Layer* layer) { |
| 771 return layer->filters(); | 779 return layer->filters(); |
| 772 } | 780 } |
| 773 | 781 |
| 774 static inline const FilterOperations& Filters(LayerImpl* layer) { | 782 static inline const FilterOperations& Filters(LayerImpl* layer) { |
| 775 return layer->test_properties()->filters; | 783 return layer->test_properties()->filters; |
| 776 } | 784 } |
| 777 | 785 |
| 778 static inline const FilterOperations& BackgroundFilters(Layer* layer) { | 786 static inline const FilterOperations& BackgroundFilters(Layer* layer) { |
| 779 return layer->background_filters(); | 787 return layer->background_filters(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 TRACE_EVENT_INSTANT0( | 857 TRACE_EVENT_INSTANT0( |
| 850 "cc", "PropertyTreeBuilder::ShouldCreateRenderSurface flattening", | 858 "cc", "PropertyTreeBuilder::ShouldCreateRenderSurface flattening", |
| 851 TRACE_EVENT_SCOPE_THREAD); | 859 TRACE_EVENT_SCOPE_THREAD); |
| 852 return true; | 860 return true; |
| 853 } | 861 } |
| 854 | 862 |
| 855 // If the layer has blending. | 863 // If the layer has blending. |
| 856 // TODO(rosca): this is temporary, until blending is implemented for other | 864 // TODO(rosca): this is temporary, until blending is implemented for other |
| 857 // types of quads than RenderPassDrawQuad. Layers having descendants that draw | 865 // types of quads than RenderPassDrawQuad. Layers having descendants that draw |
| 858 // content will still create a separate rendering surface. | 866 // content will still create a separate rendering surface. |
| 859 if (!layer->uses_default_blend_mode()) { | 867 if (BlendMode(layer) != SkXfermode::kSrcOver_Mode) { |
| 860 TRACE_EVENT_INSTANT0( | 868 TRACE_EVENT_INSTANT0( |
| 861 "cc", "PropertyTreeBuilder::ShouldCreateRenderSurface blending", | 869 "cc", "PropertyTreeBuilder::ShouldCreateRenderSurface blending", |
| 862 TRACE_EVENT_SCOPE_THREAD); | 870 TRACE_EVENT_SCOPE_THREAD); |
| 863 return true; | 871 return true; |
| 864 } | 872 } |
| 865 // If the layer clips its descendants but it is not axis-aligned with respect | 873 // If the layer clips its descendants but it is not axis-aligned with respect |
| 866 // to its parent. | 874 // to its parent. |
| 867 bool layer_clips_external_content = LayerClipsSubtree(layer); | 875 bool layer_clips_external_content = LayerClipsSubtree(layer); |
| 868 if (layer_clips_external_content && !preserves_2d_axis_alignment && | 876 if (layer_clips_external_content && !preserves_2d_axis_alignment && |
| 869 num_descendants_that_draw_content > 0) { | 877 num_descendants_that_draw_content > 0) { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 } | 969 } |
| 962 | 970 |
| 963 EffectNode node; | 971 EffectNode node; |
| 964 node.owner_id = layer->id(); | 972 node.owner_id = layer->id(); |
| 965 if (AlwaysUseActiveTreeOpacity(layer)) { | 973 if (AlwaysUseActiveTreeOpacity(layer)) { |
| 966 data_for_children->property_trees->always_use_active_tree_opacity_effect_ids | 974 data_for_children->property_trees->always_use_active_tree_opacity_effect_ids |
| 967 .push_back(node.owner_id); | 975 .push_back(node.owner_id); |
| 968 } | 976 } |
| 969 | 977 |
| 970 node.opacity = Opacity(layer); | 978 node.opacity = Opacity(layer); |
| 979 node.blend_mode = BlendMode(layer); |
| 971 node.has_render_surface = should_create_render_surface; | 980 node.has_render_surface = should_create_render_surface; |
| 972 node.has_copy_request = HasCopyRequest(layer); | 981 node.has_copy_request = HasCopyRequest(layer); |
| 973 node.filters = Filters(layer); | 982 node.filters = Filters(layer); |
| 974 node.background_filters = BackgroundFilters(layer); | 983 node.background_filters = BackgroundFilters(layer); |
| 975 node.has_potential_opacity_animation = has_potential_opacity_animation; | 984 node.has_potential_opacity_animation = has_potential_opacity_animation; |
| 976 node.has_potential_filter_animation = has_potential_filter_animation; | 985 node.has_potential_filter_animation = has_potential_filter_animation; |
| 977 node.double_sided = DoubleSided(layer); | 986 node.double_sided = DoubleSided(layer); |
| 978 node.subtree_hidden = HideLayerAndSubtree(layer); | 987 node.subtree_hidden = HideLayerAndSubtree(layer); |
| 979 node.is_currently_animating_opacity = OpacityIsAnimating(layer); | 988 node.is_currently_animating_opacity = OpacityIsAnimating(layer); |
| 980 node.is_currently_animating_filter = FilterIsAnimating(layer); | 989 node.is_currently_animating_filter = FilterIsAnimating(layer); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1185 | 1194 |
| 1186 DataForRecursion<LayerType> data_for_children(data_from_parent); | 1195 DataForRecursion<LayerType> data_for_children(data_from_parent); |
| 1187 | 1196 |
| 1188 bool created_render_surface = | 1197 bool created_render_surface = |
| 1189 AddEffectNodeIfNeeded(data_from_parent, layer, &data_for_children); | 1198 AddEffectNodeIfNeeded(data_from_parent, layer, &data_for_children); |
| 1190 | 1199 |
| 1191 if (created_render_surface) { | 1200 if (created_render_surface) { |
| 1192 data_for_children.render_target = data_for_children.effect_tree_parent; | 1201 data_for_children.render_target = data_for_children.effect_tree_parent; |
| 1193 layer->set_draw_blend_mode(SkXfermode::kSrcOver_Mode); | 1202 layer->set_draw_blend_mode(SkXfermode::kSrcOver_Mode); |
| 1194 } else { | 1203 } else { |
| 1195 layer->set_draw_blend_mode(layer->blend_mode()); | 1204 layer->set_draw_blend_mode(BlendMode(layer)); |
| 1196 } | 1205 } |
| 1197 | 1206 |
| 1198 bool created_transform_node = AddTransformNodeIfNeeded( | 1207 bool created_transform_node = AddTransformNodeIfNeeded( |
| 1199 data_from_parent, layer, created_render_surface, &data_for_children); | 1208 data_from_parent, layer, created_render_surface, &data_for_children); |
| 1200 AddClipNodeIfNeeded(data_from_parent, layer, created_render_surface, | 1209 AddClipNodeIfNeeded(data_from_parent, layer, created_render_surface, |
| 1201 created_transform_node, &data_for_children); | 1210 created_transform_node, &data_for_children); |
| 1202 | 1211 |
| 1203 AddScrollNodeIfNeeded(data_from_parent, layer, &data_for_children); | 1212 AddScrollNodeIfNeeded(data_from_parent, layer, &data_for_children); |
| 1204 | 1213 |
| 1205 SetBackfaceVisibilityTransform(layer, created_transform_node); | 1214 SetBackfaceVisibilityTransform(layer, created_transform_node); |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1463 color = SkColorSetA(color, 255); | 1472 color = SkColorSetA(color, 255); |
| 1464 BuildPropertyTreesTopLevelInternal( | 1473 BuildPropertyTreesTopLevelInternal( |
| 1465 root_layer, page_scale_layer, inner_viewport_scroll_layer, | 1474 root_layer, page_scale_layer, inner_viewport_scroll_layer, |
| 1466 outer_viewport_scroll_layer, overscroll_elasticity_layer, | 1475 outer_viewport_scroll_layer, overscroll_elasticity_layer, |
| 1467 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, | 1476 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, |
| 1468 device_transform, property_trees, color); | 1477 device_transform, property_trees, color); |
| 1469 property_trees->ResetCachedData(); | 1478 property_trees->ResetCachedData(); |
| 1470 } | 1479 } |
| 1471 | 1480 |
| 1472 } // namespace cc | 1481 } // namespace cc |
| OLD | NEW |