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

Unified Diff: cc/animation/layer_animation_controller.cc

Issue 1076313006: Animation start scale should be considered for the raster scale (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing and Added more tests 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/animation/layer_animation_controller.h ('k') | cc/animation/layer_animation_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/animation/layer_animation_controller.cc
diff --git a/cc/animation/layer_animation_controller.cc b/cc/animation/layer_animation_controller.cc
index 25e38cc6dc697e99f9e94098907ee7c6e46233a2..91bfe54e159157f9c14df99dd220890dc62c520b 100644
--- a/cc/animation/layer_animation_controller.cc
+++ b/cc/animation/layer_animation_controller.cc
@@ -513,6 +513,36 @@ bool LayerAnimationController::AnimationsPreserveAxisAlignment() const {
return true;
}
+bool LayerAnimationController::AnimationStartScale(float* start_scale) const {
+ *start_scale = 0.f;
+ for (size_t i = 0; i < animations_.size(); ++i) {
+ if (animations_[i]->is_finished() ||
+ animations_[i]->target_property() != Animation::TRANSFORM)
+ continue;
+
+ bool forward_direction = true;
+ switch (animations_[i]->direction()) {
+ case Animation::DIRECTION_NORMAL:
+ case Animation::DIRECTION_ALTERNATE:
+ forward_direction = animations_[i]->playback_rate() >= 0.0;
+ break;
+ case Animation::DIRECTION_REVERSE:
+ case Animation::DIRECTION_ALTERNATE_REVERSE:
+ forward_direction = animations_[i]->playback_rate() < 0.0;
+ break;
+ }
+
+ const TransformAnimationCurve* transform_animation_curve =
+ animations_[i]->curve()->ToTransformAnimationCurve();
+ float animation_start_scale = 0.f;
+ if (!transform_animation_curve->AnimationStartScale(forward_direction,
+ &animation_start_scale))
+ return false;
+ *start_scale = std::max(*start_scale, animation_start_scale);
+ }
+ return true;
+}
+
bool LayerAnimationController::MaximumTargetScale(float* max_scale) const {
*max_scale = 0.f;
for (size_t i = 0; i < animations_.size(); ++i) {
« no previous file with comments | « cc/animation/layer_animation_controller.h ('k') | cc/animation/layer_animation_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698