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

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: Add ported unittests. Created 5 years, 8 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
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 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 // non-scale/translation transforms isn't supported. 1044 // non-scale/translation transforms isn't supported.
1045 *combined_maximum_animation_contents_scale = 0.f; 1045 *combined_maximum_animation_contents_scale = 0.f;
1046 *combined_is_animating_scale = true; 1046 *combined_is_animating_scale = true;
1047 return; 1047 return;
1048 } 1048 }
1049 1049
1050 // We currently only support computing maximum scale for combinations of 1050 // We currently only support computing maximum scale for combinations of
1051 // scales and translations. We treat all non-translations as potentially 1051 // scales and translations. We treat all non-translations as potentially
1052 // affecting scale. Animations that include non-translation/scale components 1052 // affecting scale. Animations that include non-translation/scale components
1053 // will cause the computation of MaximumScale below to fail. 1053 // will cause the computation of MaximumScale below to fail.
1054 bool layer_is_animating_scale = 1054 bool layer_is_animating_scale = !layer->HasOnlyTranslationTransforms();
1055 !layer->layer_animation_controller()->HasOnlyTranslationTransforms();
1056 1055
1057 if (!layer_is_animating_scale && !ancestor_is_animating_scale) { 1056 if (!layer_is_animating_scale && !ancestor_is_animating_scale) {
1058 *combined_maximum_animation_contents_scale = 0.f; 1057 *combined_maximum_animation_contents_scale = 0.f;
1059 *combined_is_animating_scale = false; 1058 *combined_is_animating_scale = false;
1060 return; 1059 return;
1061 } 1060 }
1062 1061
1063 // We don't attempt to accumulate animation scale from multiple nodes, 1062 // We don't attempt to accumulate animation scale from multiple nodes,
1064 // because of the risk of significant overestimation. For example, one node 1063 // because of the risk of significant overestimation. For example, one node
1065 // may be increasing scale from 1 to 10 at the same time as a descendant is 1064 // may be increasing scale from 1 to 10 at the same time as a descendant is
(...skipping 11 matching lines...) Expand all
1077 if (!layer_is_animating_scale) { 1076 if (!layer_is_animating_scale) {
1078 gfx::Vector2dF layer_transform_scales = 1077 gfx::Vector2dF layer_transform_scales =
1079 MathUtil::ComputeTransform2dScaleComponents(layer->transform(), 0.f); 1078 MathUtil::ComputeTransform2dScaleComponents(layer->transform(), 0.f);
1080 *combined_maximum_animation_contents_scale = 1079 *combined_maximum_animation_contents_scale =
1081 ancestor_maximum_animation_contents_scale * 1080 ancestor_maximum_animation_contents_scale *
1082 std::max(layer_transform_scales.x(), layer_transform_scales.y()); 1081 std::max(layer_transform_scales.x(), layer_transform_scales.y());
1083 return; 1082 return;
1084 } 1083 }
1085 1084
1086 float layer_maximum_animated_scale = 0.f; 1085 float layer_maximum_animated_scale = 0.f;
1087 if (!layer->layer_animation_controller()->MaximumTargetScale( 1086 if (!layer->MaximumTargetScale(&layer_maximum_animated_scale)) {
1088 &layer_maximum_animated_scale)) {
1089 *combined_maximum_animation_contents_scale = 0.f; 1087 *combined_maximum_animation_contents_scale = 0.f;
1090 return; 1088 return;
1091 } 1089 }
1092 gfx::Vector2dF ancestor_transform_scales = 1090 gfx::Vector2dF ancestor_transform_scales =
1093 MathUtil::ComputeTransform2dScaleComponents(ancestor_transform, 0.f); 1091 MathUtil::ComputeTransform2dScaleComponents(ancestor_transform, 0.f);
1094 *combined_maximum_animation_contents_scale = 1092 *combined_maximum_animation_contents_scale =
1095 layer_maximum_animated_scale * 1093 layer_maximum_animated_scale *
1096 std::max(ancestor_transform_scales.x(), ancestor_transform_scales.y()); 1094 std::max(ancestor_transform_scales.x(), ancestor_transform_scales.y());
1097 } 1095 }
1098 1096
(...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after
2587 inputs->current_render_surface_layer_list_id); 2585 inputs->current_render_surface_layer_list_id);
2588 2586
2589 // The dummy layer list should not have been used. 2587 // The dummy layer list should not have been used.
2590 DCHECK_EQ(0u, dummy_layer_list.size()); 2588 DCHECK_EQ(0u, dummy_layer_list.size());
2591 // A root layer render_surface should always exist after 2589 // A root layer render_surface should always exist after
2592 // CalculateDrawProperties. 2590 // CalculateDrawProperties.
2593 DCHECK(inputs->root_layer->render_surface()); 2591 DCHECK(inputs->root_layer->render_surface());
2594 } 2592 }
2595 2593
2596 } // namespace cc 2594 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698