Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Side by Side Diff: cc/trees/property_tree_builder.cc

Issue 1957533002: cc : Track opacity animation changes on effect tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/property_tree.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 // Flattening (if needed) will be handled by |node|. 620 // Flattening (if needed) will be handled by |node|.
621 layer->set_should_flatten_transform_from_property_tree(false); 621 layer->set_should_flatten_transform_from_property_tree(false);
622 622
623 data_for_children->scroll_snap += node->data.scroll_snap; 623 data_for_children->scroll_snap += node->data.scroll_snap;
624 624
625 node->owner_id = layer->id(); 625 node->owner_id = layer->id();
626 626
627 return true; 627 return true;
628 } 628 }
629 629
630 bool IsAnimatingOpacity(Layer* layer) { 630 static inline bool HasPotentialOpacityAnimation(Layer* layer) {
631 return layer->HasPotentiallyRunningOpacityAnimation() || 631 return layer->HasPotentiallyRunningOpacityAnimation() ||
632 layer->OpacityCanAnimateOnImplThread(); 632 layer->OpacityCanAnimateOnImplThread();
633 } 633 }
634 634
635 bool IsAnimatingOpacity(LayerImpl* layer) { 635 static inline bool HasPotentialOpacityAnimation(LayerImpl* layer) {
636 return layer->HasPotentiallyRunningOpacityAnimation(); 636 return layer->HasPotentiallyRunningOpacityAnimation();
637 } 637 }
638 638
639 static inline bool DoubleSided(Layer* layer) { 639 static inline bool DoubleSided(Layer* layer) {
640 return layer->double_sided(); 640 return layer->double_sided();
641 } 641 }
642 642
643 static inline bool DoubleSided(LayerImpl* layer) { 643 static inline bool DoubleSided(LayerImpl* layer) {
644 return layer->test_properties()->double_sided; 644 return layer->test_properties()->double_sided;
645 } 645 }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 return false; 798 return false;
799 } 799 }
800 800
801 template <typename LayerType> 801 template <typename LayerType>
802 bool AddEffectNodeIfNeeded( 802 bool AddEffectNodeIfNeeded(
803 const DataForRecursion<LayerType>& data_from_ancestor, 803 const DataForRecursion<LayerType>& data_from_ancestor,
804 LayerType* layer, 804 LayerType* layer,
805 DataForRecursion<LayerType>* data_for_children) { 805 DataForRecursion<LayerType>* data_for_children) {
806 const bool is_root = !layer->parent(); 806 const bool is_root = !layer->parent();
807 const bool has_transparency = EffectiveOpacity(layer) != 1.f; 807 const bool has_transparency = EffectiveOpacity(layer) != 1.f;
808 const bool has_animated_opacity = IsAnimatingOpacity(layer); 808 const bool has_potential_opacity_animation =
809 HasPotentialOpacityAnimation(layer);
809 const bool should_create_render_surface = ShouldCreateRenderSurface( 810 const bool should_create_render_surface = ShouldCreateRenderSurface(
810 layer, data_from_ancestor.compound_transform_since_render_target, 811 layer, data_from_ancestor.compound_transform_since_render_target,
811 data_from_ancestor.axis_align_since_render_target); 812 data_from_ancestor.axis_align_since_render_target);
812 data_for_children->axis_align_since_render_target &= 813 data_for_children->axis_align_since_render_target &=
813 layer->AnimationsPreserveAxisAlignment(); 814 layer->AnimationsPreserveAxisAlignment();
814 815
815 bool requires_node = is_root || has_transparency || has_animated_opacity || 816 bool requires_node = is_root || has_transparency ||
817 has_potential_opacity_animation ||
816 should_create_render_surface; 818 should_create_render_surface;
817 819
818 int parent_id = data_from_ancestor.effect_tree_parent; 820 int parent_id = data_from_ancestor.effect_tree_parent;
819 821
820 if (!requires_node) { 822 if (!requires_node) {
821 layer->SetEffectTreeIndex(parent_id); 823 layer->SetEffectTreeIndex(parent_id);
822 data_for_children->effect_tree_parent = parent_id; 824 data_for_children->effect_tree_parent = parent_id;
823 data_for_children->compound_transform_since_render_target *= 825 data_for_children->compound_transform_since_render_target *=
824 layer->transform(); 826 layer->transform();
825 return false; 827 return false;
826 } 828 }
827 829
828 EffectNode node; 830 EffectNode node;
829 node.owner_id = layer->id(); 831 node.owner_id = layer->id();
830 node.data.opacity = layer->opacity(); 832 node.data.opacity = layer->opacity();
831 node.data.has_render_surface = should_create_render_surface; 833 node.data.has_render_surface = should_create_render_surface;
832 node.data.has_copy_request = layer->HasCopyRequest(); 834 node.data.has_copy_request = layer->HasCopyRequest();
833 node.data.has_background_filters = !layer->background_filters().IsEmpty(); 835 node.data.has_background_filters = !layer->background_filters().IsEmpty();
834 node.data.has_animated_opacity = has_animated_opacity; 836 node.data.has_potential_opacity_animation = has_potential_opacity_animation;
835 node.data.double_sided = DoubleSided(layer); 837 node.data.double_sided = DoubleSided(layer);
836 node.data.subtree_hidden = HideLayerAndSubtree(layer); 838 node.data.subtree_hidden = HideLayerAndSubtree(layer);
839 node.data.is_currently_animating_opacity = layer->OpacityIsAnimating();
837 840
838 if (!is_root) { 841 if (!is_root) {
839 // The effect node's transform id is used only when we create a render 842 // The effect node's transform id is used only when we create a render
840 // surface. So, we can leave the default value when we don't create a render 843 // surface. So, we can leave the default value when we don't create a render
841 // surface. 844 // surface.
842 if (should_create_render_surface) { 845 if (should_create_render_surface) {
843 // In this case, we will create a transform node, so it's safe to use the 846 // In this case, we will create a transform node, so it's safe to use the
844 // next available id from the transform tree as this effect node's 847 // next available id from the transform tree as this effect node's
845 // transform id. 848 // transform id.
846 node.data.transform_id = 849 node.data.transform_id =
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 if (SkColorGetA(color) != 255) 1273 if (SkColorGetA(color) != 255)
1271 color = SkColorSetA(color, 255); 1274 color = SkColorSetA(color, 255);
1272 BuildPropertyTreesTopLevelInternal( 1275 BuildPropertyTreesTopLevelInternal(
1273 root_layer, page_scale_layer, inner_viewport_scroll_layer, 1276 root_layer, page_scale_layer, inner_viewport_scroll_layer,
1274 outer_viewport_scroll_layer, overscroll_elasticity_layer, 1277 outer_viewport_scroll_layer, overscroll_elasticity_layer,
1275 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, 1278 elastic_overscroll, page_scale_factor, device_scale_factor, viewport,
1276 device_transform, property_trees, color); 1279 device_transform, property_trees, color);
1277 } 1280 }
1278 1281
1279 } // namespace cc 1282 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/property_tree.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698