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 "base/logging.h" | 5 #include "base/logging.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "cc/animation/timing_function.h" | 7 #include "cc/animation/timing_function.h" |
8 | 8 |
9 namespace cc { | 9 namespace cc { |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 void CubicBezierTimingFunction::Range(float* min, float* max) const { | 36 void CubicBezierTimingFunction::Range(float* min, float* max) const { |
37 double min_d = 0; | 37 double min_d = 0; |
38 double max_d = 1; | 38 double max_d = 1; |
39 bezier_.Range(&min_d, &max_d); | 39 bezier_.Range(&min_d, &max_d); |
40 *min = static_cast<float>(min_d); | 40 *min = static_cast<float>(min_d); |
41 *max = static_cast<float>(max_d); | 41 *max = static_cast<float>(max_d); |
42 } | 42 } |
43 | 43 |
44 scoped_ptr<TimingFunction> CubicBezierTimingFunction::Clone() const { | 44 scoped_ptr<TimingFunction> CubicBezierTimingFunction::Clone() const { |
45 return make_scoped_ptr(new CubicBezierTimingFunction(*this)); | 45 return make_scoped_ptr(new CubicBezierTimingFunction(*this)) |
| 46 .PassAs<TimingFunction>(); |
46 } | 47 } |
47 | 48 |
48 // These numbers come from | 49 // These numbers come from |
49 // http://www.w3.org/TR/css3-transitions/#transition-timing-function_tag. | 50 // http://www.w3.org/TR/css3-transitions/#transition-timing-function_tag. |
50 scoped_ptr<TimingFunction> EaseTimingFunction::Create() { | 51 scoped_ptr<TimingFunction> EaseTimingFunction::Create() { |
51 return CubicBezierTimingFunction::Create(0.25, 0.1, 0.25, 1.0); | 52 return CubicBezierTimingFunction::Create( |
| 53 0.25, 0.1, 0.25, 1.0).PassAs<TimingFunction>(); |
52 } | 54 } |
53 | 55 |
54 scoped_ptr<TimingFunction> EaseInTimingFunction::Create() { | 56 scoped_ptr<TimingFunction> EaseInTimingFunction::Create() { |
55 return CubicBezierTimingFunction::Create(0.42, 0.0, 1.0, 1.0); | 57 return CubicBezierTimingFunction::Create( |
| 58 0.42, 0.0, 1.0, 1.0).PassAs<TimingFunction>(); |
56 } | 59 } |
57 | 60 |
58 scoped_ptr<TimingFunction> EaseOutTimingFunction::Create() { | 61 scoped_ptr<TimingFunction> EaseOutTimingFunction::Create() { |
59 return CubicBezierTimingFunction::Create(0.0, 0.0, 0.58, 1.0); | 62 return CubicBezierTimingFunction::Create( |
| 63 0.0, 0.0, 0.58, 1.0).PassAs<TimingFunction>(); |
60 } | 64 } |
61 | 65 |
62 scoped_ptr<TimingFunction> EaseInOutTimingFunction::Create() { | 66 scoped_ptr<TimingFunction> EaseInOutTimingFunction::Create() { |
63 return CubicBezierTimingFunction::Create(0.42, 0.0, 0.58, 1); | 67 return CubicBezierTimingFunction::Create( |
| 68 0.42, 0.0, 0.58, 1).PassAs<TimingFunction>(); |
64 } | 69 } |
65 | 70 |
66 } // namespace cc | 71 } // namespace cc |
OLD | NEW |