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

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

Issue 1010663002: CC Animations: Redirect all compositor animation requests to AnimationHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@introduce
Patch Set: Rebase. Created 5 years, 5 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/layer_tree_host.cc ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 *combined_maximum_animation_contents_scale = 0.f; 957 *combined_maximum_animation_contents_scale = 0.f;
958 *combined_starting_animation_contents_scale = 0.f; 958 *combined_starting_animation_contents_scale = 0.f;
959 *combined_is_animating_scale = true; 959 *combined_is_animating_scale = true;
960 return; 960 return;
961 } 961 }
962 962
963 // We currently only support computing maximum scale for combinations of 963 // We currently only support computing maximum scale for combinations of
964 // scales and translations. We treat all non-translations as potentially 964 // scales and translations. We treat all non-translations as potentially
965 // affecting scale. Animations that include non-translation/scale components 965 // affecting scale. Animations that include non-translation/scale components
966 // will cause the computation of MaximumScale below to fail. 966 // will cause the computation of MaximumScale below to fail.
967 bool layer_is_animating_scale = 967 bool layer_is_animating_scale = !layer->HasOnlyTranslationTransforms();
968 !layer->layer_animation_controller()->HasOnlyTranslationTransforms();
969 968
970 if (!layer_is_animating_scale && !ancestor_is_animating_scale) { 969 if (!layer_is_animating_scale && !ancestor_is_animating_scale) {
971 *combined_maximum_animation_contents_scale = 0.f; 970 *combined_maximum_animation_contents_scale = 0.f;
972 *combined_starting_animation_contents_scale = 0.f; 971 *combined_starting_animation_contents_scale = 0.f;
973 *combined_is_animating_scale = false; 972 *combined_is_animating_scale = false;
974 return; 973 return;
975 } 974 }
976 975
977 // We don't attempt to accumulate animation scale from multiple nodes, 976 // We don't attempt to accumulate animation scale from multiple nodes,
978 // because of the risk of significant overestimation. For example, one node 977 // because of the risk of significant overestimation. For example, one node
(...skipping 16 matching lines...) Expand all
995 *combined_maximum_animation_contents_scale = 994 *combined_maximum_animation_contents_scale =
996 ancestor_maximum_animation_contents_scale * 995 ancestor_maximum_animation_contents_scale *
997 std::max(layer_transform_scales.x(), layer_transform_scales.y()); 996 std::max(layer_transform_scales.x(), layer_transform_scales.y());
998 *combined_starting_animation_contents_scale = 997 *combined_starting_animation_contents_scale =
999 *combined_maximum_animation_contents_scale; 998 *combined_maximum_animation_contents_scale;
1000 return; 999 return;
1001 } 1000 }
1002 1001
1003 float layer_maximum_animated_scale = 0.f; 1002 float layer_maximum_animated_scale = 0.f;
1004 float layer_start_animated_scale = 0.f; 1003 float layer_start_animated_scale = 0.f;
1005 if (!layer->layer_animation_controller()->MaximumTargetScale( 1004 if (!layer->MaximumTargetScale(&layer_maximum_animated_scale)) {
1006 &layer_maximum_animated_scale)) {
1007 *combined_maximum_animation_contents_scale = 0.f; 1005 *combined_maximum_animation_contents_scale = 0.f;
1008 return; 1006 return;
1009 } 1007 }
1010 if (!layer->layer_animation_controller()->AnimationStartScale( 1008 if (!layer->AnimationStartScale(&layer_start_animated_scale)) {
1011 &layer_start_animated_scale)) {
1012 *combined_starting_animation_contents_scale = 0.f; 1009 *combined_starting_animation_contents_scale = 0.f;
1013 return; 1010 return;
1014 } 1011 }
1015 1012
1016 gfx::Vector2dF ancestor_transform_scales = 1013 gfx::Vector2dF ancestor_transform_scales =
1017 MathUtil::ComputeTransform2dScaleComponents(ancestor_transform, 0.f); 1014 MathUtil::ComputeTransform2dScaleComponents(ancestor_transform, 0.f);
1018 float max_scale_xy = 1015 float max_scale_xy =
1019 std::max(ancestor_transform_scales.x(), ancestor_transform_scales.y()); 1016 std::max(ancestor_transform_scales.x(), ancestor_transform_scales.y());
1020 *combined_maximum_animation_contents_scale = 1017 *combined_maximum_animation_contents_scale =
1021 layer_maximum_animated_scale * max_scale_xy; 1018 layer_maximum_animated_scale * max_scale_xy;
(...skipping 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after
2642 2639
2643 PropertyTrees* GetPropertyTrees(Layer* layer) { 2640 PropertyTrees* GetPropertyTrees(Layer* layer) {
2644 return layer->layer_tree_host()->property_trees(); 2641 return layer->layer_tree_host()->property_trees();
2645 } 2642 }
2646 2643
2647 PropertyTrees* GetPropertyTrees(LayerImpl* layer) { 2644 PropertyTrees* GetPropertyTrees(LayerImpl* layer) {
2648 return layer->layer_tree_impl()->property_trees(); 2645 return layer->layer_tree_impl()->property_trees();
2649 } 2646 }
2650 2647
2651 } // namespace cc 2648 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host.cc ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698