summaryrefslogtreecommitdiff
path: root/chromium/cc/animation/keyframed_animation_curve.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/cc/animation/keyframed_animation_curve.cc')
-rw-r--r--chromium/cc/animation/keyframed_animation_curve.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/chromium/cc/animation/keyframed_animation_curve.cc b/chromium/cc/animation/keyframed_animation_curve.cc
index c016c91335b..14dfd9c8446 100644
--- a/chromium/cc/animation/keyframed_animation_curve.cc
+++ b/chromium/cc/animation/keyframed_animation_curve.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "cc/animation/keyframed_animation_curve.h"
+#include "ui/gfx/box_f.h"
namespace cc {
@@ -231,6 +232,28 @@ gfx::Transform KeyframedTransformAnimationCurve::GetValue(double t) const {
return GetCurveValue<gfx::Transform, TransformKeyframe>(&keyframes_, t);
}
+bool KeyframedTransformAnimationCurve::AnimatedBoundsForBox(
+ const gfx::BoxF& box,
+ gfx::BoxF* bounds) const {
+ DCHECK_GE(keyframes_.size(), 2ul);
+ *bounds = gfx::BoxF();
+ for (size_t i = 0; i < keyframes_.size() - 1; ++i) {
+ gfx::BoxF bounds_for_step;
+ float min_progress = 0.0;
+ float max_progress = 1.0;
+ if (keyframes_[i]->timing_function())
+ keyframes_[i]->timing_function()->Range(&min_progress, &max_progress);
+ if (!keyframes_[i+1]->Value().BlendedBoundsForBox(box,
+ keyframes_[i]->Value(),
+ min_progress,
+ max_progress,
+ &bounds_for_step))
+ return false;
+ bounds->Union(bounds_for_step);
+ }
+ return true;
+}
+
scoped_ptr<KeyframedFilterAnimationCurve> KeyframedFilterAnimationCurve::
Create() {
return make_scoped_ptr(new KeyframedFilterAnimationCurve);