OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "platform/animation/CompositorFloatAnimationCurve.h" | 5 #include "platform/animation/CompositorFloatAnimationCurve.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 "wtf/PtrUtil.h" |
| 11 #include <memory> |
10 | 12 |
11 using blink::CompositorFloatKeyframe; | 13 using blink::CompositorFloatKeyframe; |
12 | 14 |
13 namespace blink { | 15 namespace blink { |
14 | 16 |
15 CompositorFloatAnimationCurve::CompositorFloatAnimationCurve() | 17 CompositorFloatAnimationCurve::CompositorFloatAnimationCurve() |
16 : m_curve(cc::KeyframedFloatAnimationCurve::Create()) | 18 : m_curve(cc::KeyframedFloatAnimationCurve::Create()) |
17 { | 19 { |
18 } | 20 } |
19 | 21 |
20 CompositorFloatAnimationCurve::CompositorFloatAnimationCurve(std::unique_ptr<cc:
:KeyframedFloatAnimationCurve> curve) | 22 CompositorFloatAnimationCurve::CompositorFloatAnimationCurve(std::unique_ptr<cc:
:KeyframedFloatAnimationCurve> curve) |
21 : m_curve(std::move(curve)) | 23 : m_curve(std::move(curve)) |
22 { | 24 { |
23 } | 25 } |
24 | 26 |
25 CompositorFloatAnimationCurve::~CompositorFloatAnimationCurve() | 27 CompositorFloatAnimationCurve::~CompositorFloatAnimationCurve() |
26 { | 28 { |
27 } | 29 } |
28 | 30 |
29 PassOwnPtr<CompositorFloatAnimationCurve> CompositorFloatAnimationCurve::CreateF
orTesting(std::unique_ptr<cc::KeyframedFloatAnimationCurve> curve) | 31 std::unique_ptr<CompositorFloatAnimationCurve> CompositorFloatAnimationCurve::Cr
eateForTesting(std::unique_ptr<cc::KeyframedFloatAnimationCurve> curve) |
30 { | 32 { |
31 return adoptPtr(new CompositorFloatAnimationCurve(std::move(curve))); | 33 return wrapUnique(new CompositorFloatAnimationCurve(std::move(curve))); |
32 } | 34 } |
33 | 35 |
34 Vector<CompositorFloatKeyframe> CompositorFloatAnimationCurve::keyframesForTesti
ng() const | 36 Vector<CompositorFloatKeyframe> CompositorFloatAnimationCurve::keyframesForTesti
ng() const |
35 { | 37 { |
36 Vector<CompositorFloatKeyframe> keyframes; | 38 Vector<CompositorFloatKeyframe> keyframes; |
37 for (const auto& ccKeyframe : m_curve->keyframes_for_testing()) { | 39 for (const auto& ccKeyframe : m_curve->keyframes_for_testing()) { |
38 CompositorFloatKeyframe keyframe(ccKeyframe->Time().InSecondsF(), ccKeyf
rame->Value()); | 40 CompositorFloatKeyframe keyframe(ccKeyframe->Time().InSecondsF(), ccKeyf
rame->Value()); |
39 keyframes.append(keyframe); | 41 keyframes.append(keyframe); |
40 } | 42 } |
41 return keyframes; | 43 return keyframes; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 { | 126 { |
125 return m_curve->GetValue(base::TimeDelta::FromSecondsD(time)); | 127 return m_curve->GetValue(base::TimeDelta::FromSecondsD(time)); |
126 } | 128 } |
127 | 129 |
128 std::unique_ptr<cc::AnimationCurve> CompositorFloatAnimationCurve::cloneToAnimat
ionCurve() const | 130 std::unique_ptr<cc::AnimationCurve> CompositorFloatAnimationCurve::cloneToAnimat
ionCurve() const |
129 { | 131 { |
130 return m_curve->Clone(); | 132 return m_curve->Clone(); |
131 } | 133 } |
132 | 134 |
133 } // namespace blink | 135 } // namespace blink |
OLD | NEW |