| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "webkit/compositor_bindings/web_transform_animation_curve_impl.h" | 5 #include "webkit/compositor_bindings/web_transform_animation_curve_impl.h" |
| 6 | 6 |
| 7 #include "cc/keyframed_animation_curve.h" | 7 #include "cc/keyframed_animation_curve.h" |
| 8 #include "cc/timing_function.h" | 8 #include "cc/timing_function.h" |
| 9 #include "cc/transform_operations.h" |
| 9 #include "webkit/compositor_bindings/web_animation_curve_common.h" | 10 #include "webkit/compositor_bindings/web_animation_curve_common.h" |
| 11 #include "webkit/compositor_bindings/web_transform_operations_impl.h" |
| 10 | 12 |
| 11 namespace WebKit { | 13 namespace WebKit { |
| 12 | 14 |
| 13 WebTransformAnimationCurveImpl::WebTransformAnimationCurveImpl() | 15 WebTransformAnimationCurveImpl::WebTransformAnimationCurveImpl() |
| 14 : m_curve(cc::KeyframedTransformAnimationCurve::create()) | 16 : m_curve(cc::KeyframedTransformAnimationCurve::create()) |
| 15 { | 17 { |
| 16 } | 18 } |
| 17 | 19 |
| 18 WebTransformAnimationCurveImpl::~WebTransformAnimationCurveImpl() | 20 WebTransformAnimationCurveImpl::~WebTransformAnimationCurveImpl() |
| 19 { | 21 { |
| 20 } | 22 } |
| 21 | 23 |
| 22 WebAnimationCurve::AnimationCurveType WebTransformAnimationCurveImpl::type() con
st | 24 WebAnimationCurve::AnimationCurveType WebTransformAnimationCurveImpl::type() con
st |
| 23 { | 25 { |
| 24 return WebAnimationCurve::AnimationCurveTypeTransform; | 26 return WebAnimationCurve::AnimationCurveTypeTransform; |
| 25 } | 27 } |
| 26 | 28 |
| 27 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe) | 29 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe) |
| 28 { | 30 { |
| 29 add(keyframe, TimingFunctionTypeEase); | 31 add(keyframe, TimingFunctionTypeEase); |
| 30 } | 32 } |
| 31 | 33 |
| 32 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, T
imingFunctionType type) | 34 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, T
imingFunctionType type) |
| 33 { | 35 { |
| 34 m_curve->addKeyframe(cc::TransformKeyframe::create(keyframe.time, keyframe.v
alue, createTimingFunction(type))); | 36 const cc::TransformOperations& transformOperations = |
| 37 static_cast<const WebTransformOperationsImpl&>(keyframe.value()).AsTrans
formOperations(); |
| 38 m_curve->addKeyframe(cc::TransformKeyframe::create(keyframe.time(), transfor
mOperations, createTimingFunction(type))); |
| 35 } | 39 } |
| 36 | 40 |
| 37 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, d
ouble x1, double y1, double x2, double y2) | 41 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, d
ouble x1, double y1, double x2, double y2) |
| 38 { | 42 { |
| 39 m_curve->addKeyframe(cc::TransformKeyframe::create(keyframe.time, keyframe.v
alue, cc::CubicBezierTimingFunction::create(x1, y1, x2, y2).PassAs<cc::TimingFun
ction>())); | 43 const cc::TransformOperations& transformOperations = |
| 44 static_cast<const WebTransformOperationsImpl&>(keyframe.value()).AsTrans
formOperations(); |
| 45 m_curve->addKeyframe(cc::TransformKeyframe::create(keyframe.time(), transfor
mOperations, cc::CubicBezierTimingFunction::create(x1, y1, x2, y2).PassAs<cc::Ti
mingFunction>())); |
| 40 } | 46 } |
| 41 | 47 |
| 42 WebTransformationMatrix WebTransformAnimationCurveImpl::getValue(double time) co
nst | 48 WebTransformationMatrix WebTransformAnimationCurveImpl::getValue(double time) co
nst |
| 43 { | 49 { |
| 44 return m_curve->getValue(time); | 50 return m_curve->getValue(time); |
| 45 } | 51 } |
| 46 | 52 |
| 47 scoped_ptr<cc::AnimationCurve> WebTransformAnimationCurveImpl::cloneToAnimationC
urve() const | 53 scoped_ptr<cc::AnimationCurve> WebTransformAnimationCurveImpl::cloneToAnimationC
urve() const |
| 48 { | 54 { |
| 49 return m_curve->clone(); | 55 return m_curve->clone(); |
| 50 } | 56 } |
| 51 | 57 |
| 52 } // namespace WebKit | 58 } // namespace WebKit |
| OLD | NEW |