| 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 "WebFloatAnimationCurveImpl.h" | 7 #include "WebFloatAnimationCurveImpl.h" |
| 8 | 8 |
| 9 #include "WebAnimationCurveCommon.h" | 9 #include "WebAnimationCurveCommon.h" |
| 10 #include "cc/animation_curve.h" | 10 #include "cc/animation_curve.h" |
| 11 #include "cc/keyframed_animation_curve.h" | 11 #include "cc/keyframed_animation_curve.h" |
| 12 #include "cc/timing_function.h" | 12 #include "cc/timing_function.h" |
| 13 | 13 |
| 14 namespace WebKit { | 14 namespace WebKit { |
| 15 | 15 |
| 16 WebFloatAnimationCurve* WebFloatAnimationCurve::create() | 16 WebFloatAnimationCurve* WebFloatAnimationCurve::create() |
| 17 { | 17 { |
| 18 return new WebFloatAnimationCurveImpl(); | 18 return new WebFloatAnimationCurveImpl(); |
| 19 } | 19 } |
| 20 | 20 |
| 21 WebFloatAnimationCurveImpl::WebFloatAnimationCurveImpl() | 21 WebFloatAnimationCurveImpl::WebFloatAnimationCurveImpl() |
| 22 : m_curve(cc::CCKeyframedFloatAnimationCurve::create()) | 22 : m_curve(cc::KeyframedFloatAnimationCurve::create()) |
| 23 { | 23 { |
| 24 } | 24 } |
| 25 | 25 |
| 26 WebFloatAnimationCurveImpl::~WebFloatAnimationCurveImpl() | 26 WebFloatAnimationCurveImpl::~WebFloatAnimationCurveImpl() |
| 27 { | 27 { |
| 28 } | 28 } |
| 29 | 29 |
| 30 WebAnimationCurve::AnimationCurveType WebFloatAnimationCurveImpl::type() const | 30 WebAnimationCurve::AnimationCurveType WebFloatAnimationCurveImpl::type() const |
| 31 { | 31 { |
| 32 return WebAnimationCurve::AnimationCurveTypeFloat; | 32 return WebAnimationCurve::AnimationCurveTypeFloat; |
| 33 } | 33 } |
| 34 | 34 |
| 35 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe) | 35 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe) |
| 36 { | 36 { |
| 37 add(keyframe, TimingFunctionTypeEase); | 37 add(keyframe, TimingFunctionTypeEase); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, TimingFun
ctionType type) | 40 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, TimingFun
ctionType type) |
| 41 { | 41 { |
| 42 m_curve->addKeyframe(cc::CCFloatKeyframe::create(keyframe.time, keyframe.val
ue, createTimingFunction(type))); | 42 m_curve->addKeyframe(cc::FloatKeyframe::create(keyframe.time, keyframe.value
, createTimingFunction(type))); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, double x1
, double y1, double x2, double y2) | 45 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, double x1
, double y1, double x2, double y2) |
| 46 { | 46 { |
| 47 m_curve->addKeyframe(cc::CCFloatKeyframe::create(keyframe.time, keyframe.val
ue, cc::CCCubicBezierTimingFunction::create(x1, y1, x2, y2).PassAs<cc::CCTimingF
unction>())); | 47 m_curve->addKeyframe(cc::FloatKeyframe::create(keyframe.time, keyframe.value
, cc::CubicBezierTimingFunction::create(x1, y1, x2, y2).PassAs<cc::TimingFunctio
n>())); |
| 48 } | 48 } |
| 49 | 49 |
| 50 float WebFloatAnimationCurveImpl::getValue(double time) const | 50 float WebFloatAnimationCurveImpl::getValue(double time) const |
| 51 { | 51 { |
| 52 return m_curve->getValue(time); | 52 return m_curve->getValue(time); |
| 53 } | 53 } |
| 54 | 54 |
| 55 scoped_ptr<cc::CCAnimationCurve> WebFloatAnimationCurveImpl::cloneToCCAnimationC
urve() const | 55 scoped_ptr<cc::AnimationCurve> WebFloatAnimationCurveImpl::cloneToAnimationCurve
() const |
| 56 { | 56 { |
| 57 return m_curve->clone(); | 57 return m_curve->clone(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 } // namespace WebKit | 60 } // namespace WebKit |
| OLD | NEW |