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_float_animation_curve_impl.h" | 5 #include "webkit/compositor_bindings/web_float_animation_curve_impl.h" |
6 | 6 |
7 #include "cc/animation_curve.h" | 7 #include "cc/animation_curve.h" |
8 #include "cc/keyframed_animation_curve.h" | 8 #include "cc/keyframed_animation_curve.h" |
9 #include "cc/timing_function.h" | 9 #include "cc/timing_function.h" |
10 #include "webkit/compositor_bindings/web_animation_curve_common.h" | 10 #include "webkit/compositor_bindings/web_animation_curve_common.h" |
11 | 11 |
12 namespace WebKit { | 12 namespace WebKit { |
13 | 13 |
14 WebFloatAnimationCurveImpl::WebFloatAnimationCurveImpl() | 14 WebFloatAnimationCurveImpl::WebFloatAnimationCurveImpl() |
15 : curve_(cc::KeyframedFloatAnimationCurve::create()) {} | 15 : curve_(cc::KeyframedFloatAnimationCurve::Create()) {} |
16 | 16 |
17 WebFloatAnimationCurveImpl::~WebFloatAnimationCurveImpl() {} | 17 WebFloatAnimationCurveImpl::~WebFloatAnimationCurveImpl() {} |
18 | 18 |
19 WebAnimationCurve::AnimationCurveType WebFloatAnimationCurveImpl::type() const { | 19 WebAnimationCurve::AnimationCurveType WebFloatAnimationCurveImpl::type() const { |
20 return WebAnimationCurve::AnimationCurveTypeFloat; | 20 return WebAnimationCurve::AnimationCurveTypeFloat; |
21 } | 21 } |
22 | 22 |
23 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe) { | 23 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe) { |
24 add(keyframe, TimingFunctionTypeEase); | 24 add(keyframe, TimingFunctionTypeEase); |
25 } | 25 } |
26 | 26 |
27 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, | 27 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, |
28 TimingFunctionType type) { | 28 TimingFunctionType type) { |
29 curve_->addKeyframe(cc::FloatKeyframe::create( | 29 curve_->AddKeyframe(cc::FloatKeyframe::Create( |
30 keyframe.time, keyframe.value, createTimingFunction(type))); | 30 keyframe.time, keyframe.value, createTimingFunction(type))); |
31 } | 31 } |
32 | 32 |
33 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, | 33 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, |
34 double x1, | 34 double x1, |
35 double y1, | 35 double y1, |
36 double x2, | 36 double x2, |
37 double y2) { | 37 double y2) { |
38 curve_->addKeyframe(cc::FloatKeyframe::create( | 38 curve_->AddKeyframe(cc::FloatKeyframe::Create( |
39 keyframe.time, | 39 keyframe.time, |
40 keyframe.value, | 40 keyframe.value, |
41 cc::CubicBezierTimingFunction::create(x1, y1, x2, y2) | 41 cc::CubicBezierTimingFunction::create(x1, y1, x2, y2) |
42 .PassAs<cc::TimingFunction>())); | 42 .PassAs<cc::TimingFunction>())); |
43 } | 43 } |
44 | 44 |
45 float WebFloatAnimationCurveImpl::getValue(double time) const { | 45 float WebFloatAnimationCurveImpl::getValue(double time) const { |
46 return curve_->getValue(time); | 46 return curve_->GetValue(time); |
47 } | 47 } |
48 | 48 |
49 scoped_ptr<cc::AnimationCurve> | 49 scoped_ptr<cc::AnimationCurve> |
50 WebFloatAnimationCurveImpl::cloneToAnimationCurve() const { | 50 WebFloatAnimationCurveImpl::cloneToAnimationCurve() const { |
51 return curve_->clone(); | 51 return curve_->Clone(); |
52 } | 52 } |
53 | 53 |
54 } // namespace WebKit | 54 } // namespace WebKit |
OLD | NEW |