| 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "WebTransformAnimationCurveImpl.h" | 7 #include "WebTransformAnimationCurveImpl.h" |
| 8 | 8 |
| 9 #include "WebAnimationCurveCommon.h" | 9 #include "WebAnimationCurveCommon.h" |
| 10 #include "cc/keyframed_animation_curve.h" | 10 #include "cc/keyframed_animation_curve.h" |
| 11 #include "cc/timing_function.h" | 11 #include "cc/timing_function.h" |
| 12 | 12 |
| 13 namespace WebKit { | 13 namespace WebKit { |
| 14 | 14 |
| 15 WebTransformAnimationCurve* WebTransformAnimationCurve::create() | 15 WebTransformAnimationCurve* WebTransformAnimationCurve::create() |
| 16 { | 16 { |
| 17 return new WebTransformAnimationCurveImpl(); | 17 return new WebTransformAnimationCurveImpl(); |
| 18 } | 18 } |
| 19 | 19 |
| 20 WebTransformAnimationCurveImpl::WebTransformAnimationCurveImpl() | 20 WebTransformAnimationCurveImpl::WebTransformAnimationCurveImpl() |
| 21 : m_curve(cc::CCKeyframedTransformAnimationCurve::create()) | 21 : m_curve(cc::KeyframedTransformAnimationCurve::create()) |
| 22 { | 22 { |
| 23 } | 23 } |
| 24 | 24 |
| 25 WebTransformAnimationCurveImpl::~WebTransformAnimationCurveImpl() | 25 WebTransformAnimationCurveImpl::~WebTransformAnimationCurveImpl() |
| 26 { | 26 { |
| 27 } | 27 } |
| 28 | 28 |
| 29 WebAnimationCurve::AnimationCurveType WebTransformAnimationCurveImpl::type() con
st | 29 WebAnimationCurve::AnimationCurveType WebTransformAnimationCurveImpl::type() con
st |
| 30 { | 30 { |
| 31 return WebAnimationCurve::AnimationCurveTypeTransform; | 31 return WebAnimationCurve::AnimationCurveTypeTransform; |
| 32 } | 32 } |
| 33 | 33 |
| 34 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe) | 34 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe) |
| 35 { | 35 { |
| 36 add(keyframe, TimingFunctionTypeEase); | 36 add(keyframe, TimingFunctionTypeEase); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, T
imingFunctionType type) | 39 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, T
imingFunctionType type) |
| 40 { | 40 { |
| 41 m_curve->addKeyframe(cc::CCTransformKeyframe::create(keyframe.time, keyframe
.value, createTimingFunction(type))); | 41 m_curve->addKeyframe(cc::TransformKeyframe::create(keyframe.time, keyframe.v
alue, createTimingFunction(type))); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, d
ouble x1, double y1, double x2, double y2) | 44 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, d
ouble x1, double y1, double x2, double y2) |
| 45 { | 45 { |
| 46 m_curve->addKeyframe(cc::CCTransformKeyframe::create(keyframe.time, keyframe
.value, cc::CCCubicBezierTimingFunction::create(x1, y1, x2, y2).PassAs<cc::CCTim
ingFunction>())); | 46 m_curve->addKeyframe(cc::TransformKeyframe::create(keyframe.time, keyframe.v
alue, cc::CubicBezierTimingFunction::create(x1, y1, x2, y2).PassAs<cc::TimingFun
ction>())); |
| 47 } | 47 } |
| 48 | 48 |
| 49 WebTransformationMatrix WebTransformAnimationCurveImpl::getValue(double time) co
nst | 49 WebTransformationMatrix WebTransformAnimationCurveImpl::getValue(double time) co
nst |
| 50 { | 50 { |
| 51 return m_curve->getValue(time); | 51 return m_curve->getValue(time); |
| 52 } | 52 } |
| 53 | 53 |
| 54 scoped_ptr<cc::CCAnimationCurve> WebTransformAnimationCurveImpl::cloneToCCAnimat
ionCurve() const | 54 scoped_ptr<cc::AnimationCurve> WebTransformAnimationCurveImpl::cloneToAnimationC
urve() const |
| 55 { | 55 { |
| 56 return m_curve->clone(); | 56 return m_curve->clone(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 } // namespace WebKit | 59 } // namespace WebKit |
| OLD | NEW |