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