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

Unified Diff: cc/keyframed_animation_curve.cc

Issue 11876016: Define cc::TransformOperations and webkit::WebTransformOperationsImpl (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Put TransformOperation into its own header Created 7 years, 11 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/keyframed_animation_curve.h ('k') | cc/keyframed_animation_curve_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/keyframed_animation_curve.cc
diff --git a/cc/keyframed_animation_curve.cc b/cc/keyframed_animation_curve.cc
index ef03357a26a30e96238c0a947a8c32f0787214d2..90f9315fac101726f32b5c56623cbd275746267e 100644
--- a/cc/keyframed_animation_curve.cc
+++ b/cc/keyframed_animation_curve.cc
@@ -84,6 +84,18 @@ scoped_ptr<FloatKeyframe> FloatKeyframe::clone() const
return FloatKeyframe::create(time(), value(), func.Pass());
}
+#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
+scoped_ptr<TransformKeyframe> TransformKeyframe::create(double time, const TransformOperations& value, scoped_ptr<TimingFunction> timingFunction)
+{
+ return make_scoped_ptr(new TransformKeyframe(time, value, timingFunction.Pass()));
+}
+
+TransformKeyframe::TransformKeyframe(double time, const TransformOperations& value, scoped_ptr<TimingFunction> timingFunction)
+ : Keyframe(time, timingFunction.Pass())
+ , m_value(value)
+{
+}
+#else
scoped_ptr<TransformKeyframe> TransformKeyframe::create(double time, const WebKit::WebTransformOperations& value, scoped_ptr<TimingFunction> timingFunction)
{
return make_scoped_ptr(new TransformKeyframe(time, value, timingFunction.Pass()));
@@ -94,15 +106,23 @@ TransformKeyframe::TransformKeyframe(double time, const WebKit::WebTransformOper
, m_value(value)
{
}
+#endif
TransformKeyframe::~TransformKeyframe()
{
}
+#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
+const TransformOperations& TransformKeyframe::value() const
+{
+ return m_value;
+}
+#else
const WebKit::WebTransformOperations& TransformKeyframe::value() const
{
return m_value;
}
+#endif
scoped_ptr<TransformKeyframe> TransformKeyframe::clone() const
{
@@ -198,12 +218,21 @@ scoped_ptr<AnimationCurve> KeyframedTransformAnimationCurve::clone() const
WebTransformationMatrix KeyframedTransformAnimationCurve::getValue(double t) const
{
+#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
+ if (t <= m_keyframes.front()->time())
+ return m_keyframes.front()->value().Apply();
+
+ if (t >= m_keyframes.back()->time())
+ return m_keyframes.back()->value().Apply();
+#else
if (t <= m_keyframes.front()->time())
return m_keyframes.front()->value().apply();
if (t >= m_keyframes.back()->time())
return m_keyframes.back()->value().apply();
+#endif
+
size_t i = 0;
for (; i < m_keyframes.size() - 1; ++i) {
if (t < m_keyframes[i+1]->time())
@@ -215,7 +244,11 @@ WebTransformationMatrix KeyframedTransformAnimationCurve::getValue(double t) con
if (m_keyframes[i]->timingFunction())
progress = m_keyframes[i]->timingFunction()->getValue(progress);
+#if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
+ return m_keyframes[i+1]->value().Blend(m_keyframes[i]->value(), progress);
+#else
return m_keyframes[i+1]->value().blend(m_keyframes[i]->value(), progress);
+#endif
}
} // namespace cc
« no previous file with comments | « cc/keyframed_animation_curve.h ('k') | cc/keyframed_animation_curve_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698