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

Unified Diff: cc/animation/layer_animation_controller.cc

Issue 642983003: cc: Make PictureLayerImpl use a better choice for animated raster scale. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: animationscale: fixtest Created 6 years, 2 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 911c5c426f57814305e2d69fb7ddf352290480bd..9aa67aa223a40603fc6619c8fef4110077090b4a 100644
--- a/cc/animation/layer_animation_controller.cc
+++ b/cc/animation/layer_animation_controller.cc
@@ -5,6 +5,7 @@
#include "cc/animation/layer_animation_controller.h"
#include <algorithm>
+#include <vector>
#include "cc/animation/animation.h"
#include "cc/animation/animation_delegate.h"
@@ -494,17 +495,30 @@ bool LayerAnimationController::HasOnlyTranslationTransforms() const {
return true;
}
-bool LayerAnimationController::MaximumScale(float* max_scale) const {
+bool LayerAnimationController::MaximumTargetScale(float* max_scale) const {
*max_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::Normal:
+ case Animation::Alternate:
+ forward_direction = animations_[i]->playback_rate() >= 0.0;
+ break;
+ case Animation::Reverse:
+ case Animation::AlternateReverse:
+ forward_direction = animations_[i]->playback_rate() < 0.0;
+ break;
+ }
+
const TransformAnimationCurve* transform_animation_curve =
animations_[i]->curve()->ToTransformAnimationCurve();
float animation_scale = 0.f;
- if (!transform_animation_curve->MaximumScale(&animation_scale))
+ if (!transform_animation_curve->MaximumTargetScale(forward_direction,
+ &animation_scale))
return false;
*max_scale = std::max(*max_scale, animation_scale);
}
« 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