OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "sky/viewer/cc/web_float_animation_curve_impl.h" | 5 #include "sky/viewer/cc/web_float_animation_curve_impl.h" |
6 | 6 |
7 #include "cc/animation/animation_curve.h" | 7 #include "cc/animation/animation_curve.h" |
8 #include "cc/animation/keyframed_animation_curve.h" | 8 #include "cc/animation/keyframed_animation_curve.h" |
9 #include "cc/animation/timing_function.h" | 9 #include "cc/animation/timing_function.h" |
10 #include "sky/viewer/cc/web_animation_curve_common.h" | 10 #include "sky/viewer/cc/web_animation_curve_common.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 WebFloatAnimationCurveImpl::type() const { | 24 WebFloatAnimationCurveImpl::type() const { |
25 return blink::WebCompositorAnimationCurve::AnimationCurveTypeFloat; | 25 return blink::WebCompositorAnimationCurve::AnimationCurveTypeFloat; |
26 } | 26 } |
27 | 27 |
28 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe) { | 28 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe) { |
29 add(keyframe, TimingFunctionTypeEase); | 29 add(keyframe, TimingFunctionTypeEase); |
30 } | 30 } |
31 | 31 |
32 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, | 32 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, |
33 TimingFunctionType type) { | 33 TimingFunctionType type) { |
34 curve_->AddKeyframe(cc::FloatKeyframe::Create( | 34 curve_->AddKeyframe( |
35 keyframe.time, keyframe.value, CreateTimingFunction(type))); | 35 cc::FloatKeyframe::Create(base::TimeDelta::FromSecondsD(keyframe.time), |
| 36 keyframe.value, CreateTimingFunction(type))); |
36 } | 37 } |
37 | 38 |
38 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, | 39 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, |
39 double x1, | 40 double x1, |
40 double y1, | 41 double y1, |
41 double x2, | 42 double x2, |
42 double y2) { | 43 double y2) { |
43 curve_->AddKeyframe(cc::FloatKeyframe::Create( | 44 curve_->AddKeyframe(cc::FloatKeyframe::Create( |
44 keyframe.time, | 45 base::TimeDelta::FromSecondsD(keyframe.time), keyframe.value, |
45 keyframe.value, | |
46 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2).Pass())); | 46 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2).Pass())); |
47 } | 47 } |
48 | 48 |
49 float WebFloatAnimationCurveImpl::getValue(double time) const { | 49 float WebFloatAnimationCurveImpl::getValue(double time) const { |
50 return curve_->GetValue(time); | 50 return curve_->GetValue(base::TimeDelta::FromSecondsD(time)); |
51 } | 51 } |
52 | 52 |
53 scoped_ptr<cc::AnimationCurve> | 53 scoped_ptr<cc::AnimationCurve> |
54 WebFloatAnimationCurveImpl::CloneToAnimationCurve() const { | 54 WebFloatAnimationCurveImpl::CloneToAnimationCurve() const { |
55 return curve_->Clone(); | 55 return curve_->Clone(); |
56 } | 56 } |
57 | 57 |
58 } // namespace sky_viewer_cc | 58 } // namespace sky_viewer_cc |
OLD | NEW |