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 const FilterOperations& Filters(Layer* layer) { |
| 771 return layer->filters(); |
| 772 } |
| 773 |
| 774 static inline const FilterOperations& Filters(LayerImpl* layer) { |
| 775 return layer->test_properties()->filters; |
| 776 } |
| 777 |
770 static inline const FilterOperations& BackgroundFilters(Layer* layer) { | 778 static inline const FilterOperations& BackgroundFilters(Layer* layer) { |
771 return layer->background_filters(); | 779 return layer->background_filters(); |
772 } | 780 } |
773 | 781 |
774 static inline const FilterOperations& BackgroundFilters(LayerImpl* layer) { | 782 static inline const FilterOperations& BackgroundFilters(LayerImpl* layer) { |
775 return layer->test_properties()->background_filters; | 783 return layer->test_properties()->background_filters; |
776 } | 784 } |
777 | 785 |
778 static inline bool HideLayerAndSubtree(Layer* layer) { | 786 static inline bool HideLayerAndSubtree(Layer* layer) { |
779 return layer->hide_layer_and_subtree(); | 787 return layer->hide_layer_and_subtree(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 if (MaskLayer(layer) && ReplicaLayer(Parent(layer)) != layer) { | 823 if (MaskLayer(layer) && ReplicaLayer(Parent(layer)) != layer) { |
816 return true; | 824 return true; |
817 } | 825 } |
818 | 826 |
819 // If the layer has a reflection. | 827 // If the layer has a reflection. |
820 if (ReplicaLayer(layer)) { | 828 if (ReplicaLayer(layer)) { |
821 return true; | 829 return true; |
822 } | 830 } |
823 | 831 |
824 // If the layer uses a CSS filter. | 832 // If the layer uses a CSS filter. |
825 if (!layer->filters().IsEmpty() || !BackgroundFilters(layer).IsEmpty()) { | 833 if (!Filters(layer).IsEmpty() || !BackgroundFilters(layer).IsEmpty()) { |
826 return true; | 834 return true; |
827 } | 835 } |
828 | 836 |
829 // If the layer will use a CSS filter. In this case, the animation | 837 // If the layer will use a CSS filter. In this case, the animation |
830 // will start and add a filter to this layer, so it needs a surface. | 838 // will start and add a filter to this layer, so it needs a surface. |
831 if (HasPotentiallyRunningFilterAnimation(layer)) { | 839 if (HasPotentiallyRunningFilterAnimation(layer)) { |
832 return true; | 840 return true; |
833 } | 841 } |
834 | 842 |
835 int num_descendants_that_draw_content = NumDescendantsThatDrawContent(layer); | 843 int num_descendants_that_draw_content = NumDescendantsThatDrawContent(layer); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 | 929 |
922 template <typename LayerType> | 930 template <typename LayerType> |
923 bool AddEffectNodeIfNeeded( | 931 bool AddEffectNodeIfNeeded( |
924 const DataForRecursion<LayerType>& data_from_ancestor, | 932 const DataForRecursion<LayerType>& data_from_ancestor, |
925 LayerType* layer, | 933 LayerType* layer, |
926 DataForRecursion<LayerType>* data_for_children) { | 934 DataForRecursion<LayerType>* data_for_children) { |
927 const bool is_root = !Parent(layer); | 935 const bool is_root = !Parent(layer); |
928 const bool has_transparency = EffectiveOpacity(layer) != 1.f; | 936 const bool has_transparency = EffectiveOpacity(layer) != 1.f; |
929 const bool has_potential_opacity_animation = | 937 const bool has_potential_opacity_animation = |
930 HasPotentialOpacityAnimation(layer); | 938 HasPotentialOpacityAnimation(layer); |
| 939 const bool has_potential_filter_animation = |
| 940 HasPotentiallyRunningFilterAnimation(layer); |
931 const bool should_create_render_surface = ShouldCreateRenderSurface( | 941 const bool should_create_render_surface = ShouldCreateRenderSurface( |
932 layer, data_from_ancestor.compound_transform_since_render_target, | 942 layer, data_from_ancestor.compound_transform_since_render_target, |
933 data_from_ancestor.axis_align_since_render_target); | 943 data_from_ancestor.axis_align_since_render_target); |
934 data_for_children->axis_align_since_render_target &= | 944 data_for_children->axis_align_since_render_target &= |
935 AnimationsPreserveAxisAlignment(layer); | 945 AnimationsPreserveAxisAlignment(layer); |
936 | 946 |
937 bool requires_node = is_root || has_transparency || | 947 bool requires_node = is_root || has_transparency || |
938 has_potential_opacity_animation || | 948 has_potential_opacity_animation || |
939 should_create_render_surface; | 949 should_create_render_surface; |
940 | 950 |
(...skipping 10 matching lines...) Expand all Loading... |
951 EffectNode node; | 961 EffectNode node; |
952 node.owner_id = layer->id(); | 962 node.owner_id = layer->id(); |
953 if (AlwaysUseActiveTreeOpacity(layer)) { | 963 if (AlwaysUseActiveTreeOpacity(layer)) { |
954 data_for_children->property_trees->always_use_active_tree_opacity_effect_ids | 964 data_for_children->property_trees->always_use_active_tree_opacity_effect_ids |
955 .push_back(node.owner_id); | 965 .push_back(node.owner_id); |
956 } | 966 } |
957 | 967 |
958 node.opacity = Opacity(layer); | 968 node.opacity = Opacity(layer); |
959 node.has_render_surface = should_create_render_surface; | 969 node.has_render_surface = should_create_render_surface; |
960 node.has_copy_request = HasCopyRequest(layer); | 970 node.has_copy_request = HasCopyRequest(layer); |
| 971 node.filters = Filters(layer); |
961 node.background_filters = BackgroundFilters(layer); | 972 node.background_filters = BackgroundFilters(layer); |
962 node.has_potential_opacity_animation = has_potential_opacity_animation; | 973 node.has_potential_opacity_animation = has_potential_opacity_animation; |
| 974 node.has_potential_filter_animation = has_potential_filter_animation; |
963 node.double_sided = DoubleSided(layer); | 975 node.double_sided = DoubleSided(layer); |
964 node.subtree_hidden = HideLayerAndSubtree(layer); | 976 node.subtree_hidden = HideLayerAndSubtree(layer); |
965 node.is_currently_animating_opacity = OpacityIsAnimating(layer); | 977 node.is_currently_animating_opacity = OpacityIsAnimating(layer); |
| 978 node.is_currently_animating_filter = FilterIsAnimating(layer); |
966 | 979 |
967 EffectTree& effect_tree = data_for_children->property_trees->effect_tree; | 980 EffectTree& effect_tree = data_for_children->property_trees->effect_tree; |
968 if (MaskLayer(layer)) { | 981 if (MaskLayer(layer)) { |
969 node.mask_layer_id = MaskLayer(layer)->id(); | 982 node.mask_layer_id = MaskLayer(layer)->id(); |
970 effect_tree.AddMaskOrReplicaLayerId(node.mask_layer_id); | 983 effect_tree.AddMaskOrReplicaLayerId(node.mask_layer_id); |
971 } | 984 } |
972 if (ReplicaLayer(layer)) { | 985 if (ReplicaLayer(layer)) { |
973 node.replica_layer_id = ReplicaLayer(layer)->id(); | 986 node.replica_layer_id = ReplicaLayer(layer)->id(); |
974 effect_tree.AddMaskOrReplicaLayerId(node.replica_layer_id); | 987 effect_tree.AddMaskOrReplicaLayerId(node.replica_layer_id); |
975 if (MaskLayer(ReplicaLayer(layer))) { | 988 if (MaskLayer(ReplicaLayer(layer))) { |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1439 color = SkColorSetA(color, 255); | 1452 color = SkColorSetA(color, 255); |
1440 BuildPropertyTreesTopLevelInternal( | 1453 BuildPropertyTreesTopLevelInternal( |
1441 root_layer, page_scale_layer, inner_viewport_scroll_layer, | 1454 root_layer, page_scale_layer, inner_viewport_scroll_layer, |
1442 outer_viewport_scroll_layer, overscroll_elasticity_layer, | 1455 outer_viewport_scroll_layer, overscroll_elasticity_layer, |
1443 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, | 1456 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, |
1444 device_transform, property_trees, color); | 1457 device_transform, property_trees, color); |
1445 property_trees->ResetCachedData(); | 1458 property_trees->ResetCachedData(); |
1446 } | 1459 } |
1447 | 1460 |
1448 } // namespace cc | 1461 } // namespace cc |
OLD | NEW |