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