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 "CCAnimationCurve.h" | 9 #include "CCAnimationCurve.h" |
10 #include "CCKeyframedAnimationCurve.h" | 10 #include "CCKeyframedAnimationCurve.h" |
11 #include "CCTimingFunction.h" | 11 #include "CCTimingFunction.h" |
12 #include "WebAnimationCurveCommon.h" | 12 #include "WebAnimationCurveCommon.h" |
| 13 #include <wtf/OwnPtr.h> |
| 14 #include <wtf/PassOwnPtr.h> |
13 | 15 |
14 namespace WebKit { | 16 namespace WebKit { |
15 | 17 |
16 WebFloatAnimationCurve* WebFloatAnimationCurve::create() | 18 WebFloatAnimationCurve* WebFloatAnimationCurve::create() |
17 { | 19 { |
18 return new WebFloatAnimationCurveImpl(); | 20 return new WebFloatAnimationCurveImpl(); |
19 } | 21 } |
20 | 22 |
21 WebFloatAnimationCurveImpl::WebFloatAnimationCurveImpl() | 23 WebFloatAnimationCurveImpl::WebFloatAnimationCurveImpl() |
22 : m_curve(cc::CCKeyframedFloatAnimationCurve::create()) | 24 : m_curve(cc::CCKeyframedFloatAnimationCurve::create()) |
(...skipping 14 matching lines...) Expand all Loading... |
37 add(keyframe, TimingFunctionTypeEase); | 39 add(keyframe, TimingFunctionTypeEase); |
38 } | 40 } |
39 | 41 |
40 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, TimingFun
ctionType type) | 42 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, TimingFun
ctionType type) |
41 { | 43 { |
42 m_curve->addKeyframe(cc::CCFloatKeyframe::create(keyframe.time, keyframe.val
ue, createTimingFunction(type))); | 44 m_curve->addKeyframe(cc::CCFloatKeyframe::create(keyframe.time, keyframe.val
ue, createTimingFunction(type))); |
43 } | 45 } |
44 | 46 |
45 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, double x1
, double y1, double x2, double y2) | 47 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, double x1
, double y1, double x2, double y2) |
46 { | 48 { |
47 m_curve->addKeyframe(cc::CCFloatKeyframe::create(keyframe.time, keyframe.val
ue, cc::CCCubicBezierTimingFunction::create(x1, y1, x2, y2).PassAs<cc::CCTimingF
unction>())); | 49 m_curve->addKeyframe(cc::CCFloatKeyframe::create(keyframe.time, keyframe.val
ue, cc::CCCubicBezierTimingFunction::create(x1, y1, x2, y2))); |
48 } | 50 } |
49 | 51 |
50 float WebFloatAnimationCurveImpl::getValue(double time) const | 52 float WebFloatAnimationCurveImpl::getValue(double time) const |
51 { | 53 { |
52 return m_curve->getValue(time); | 54 return m_curve->getValue(time); |
53 } | 55 } |
54 | 56 |
55 scoped_ptr<cc::CCAnimationCurve> WebFloatAnimationCurveImpl::cloneToCCAnimationC
urve() const | 57 PassOwnPtr<cc::CCAnimationCurve> WebFloatAnimationCurveImpl::cloneToCCAnimationC
urve() const |
56 { | 58 { |
57 return m_curve->clone(); | 59 return m_curve->clone(); |
58 } | 60 } |
59 | 61 |
60 } // namespace WebKit | 62 } // namespace WebKit |
OLD | NEW |