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 #ifndef CompositorFloatAnimationCurve_h | 5 #ifndef CompositorFloatAnimationCurve_h |
6 #define CompositorFloatAnimationCurve_h | 6 #define CompositorFloatAnimationCurve_h |
7 | 7 |
8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 #include "platform/animation/CompositorAnimationCurve.h" | 9 #include "platform/animation/CompositorAnimationCurve.h" |
10 #include "platform/animation/CompositorFloatKeyframe.h" | 10 #include "platform/animation/CompositorFloatKeyframe.h" |
11 #include "platform/animation/TimingFunction.h" | 11 #include "platform/animation/TimingFunction.h" |
12 #include "wtf/Noncopyable.h" | 12 #include "wtf/Noncopyable.h" |
13 #include "wtf/PassOwnPtr.h" | 13 #include "wtf/PtrUtil.h" |
14 #include "wtf/Vector.h" | 14 #include "wtf/Vector.h" |
| 15 #include <memory> |
15 | 16 |
16 namespace cc { | 17 namespace cc { |
17 class KeyframedFloatAnimationCurve; | 18 class KeyframedFloatAnimationCurve; |
18 } | 19 } |
19 | 20 |
20 namespace blink { | 21 namespace blink { |
21 struct CompositorFloatKeyframe; | 22 struct CompositorFloatKeyframe; |
22 } | 23 } |
23 | 24 |
24 namespace blink { | 25 namespace blink { |
25 | 26 |
26 // A keyframed float animation curve. | 27 // A keyframed float animation curve. |
27 class PLATFORM_EXPORT CompositorFloatAnimationCurve : public CompositorAnimation
Curve { | 28 class PLATFORM_EXPORT CompositorFloatAnimationCurve : public CompositorAnimation
Curve { |
28 WTF_MAKE_NONCOPYABLE(CompositorFloatAnimationCurve); | 29 WTF_MAKE_NONCOPYABLE(CompositorFloatAnimationCurve); |
29 public: | 30 public: |
30 static PassOwnPtr<CompositorFloatAnimationCurve> create() | 31 static std::unique_ptr<CompositorFloatAnimationCurve> create() |
31 { | 32 { |
32 return adoptPtr(new CompositorFloatAnimationCurve()); | 33 return wrapUnique(new CompositorFloatAnimationCurve()); |
33 } | 34 } |
34 | 35 |
35 ~CompositorFloatAnimationCurve() override; | 36 ~CompositorFloatAnimationCurve() override; |
36 | 37 |
37 static PassOwnPtr<CompositorFloatAnimationCurve> CreateForTesting(std::uniqu
e_ptr<cc::KeyframedFloatAnimationCurve>); | 38 static std::unique_ptr<CompositorFloatAnimationCurve> CreateForTesting(std::
unique_ptr<cc::KeyframedFloatAnimationCurve>); |
38 Vector<CompositorFloatKeyframe> keyframesForTesting() const; | 39 Vector<CompositorFloatKeyframe> keyframesForTesting() const; |
39 | 40 |
40 // TODO(loyso): Erase these methods once blink/cc timing functions unified. | 41 // TODO(loyso): Erase these methods once blink/cc timing functions unified. |
41 CubicBezierTimingFunction::EaseType getCurveEaseTypeForTesting() const; | 42 CubicBezierTimingFunction::EaseType getCurveEaseTypeForTesting() const; |
42 bool curveHasLinearTimingFunctionForTesting() const; | 43 bool curveHasLinearTimingFunctionForTesting() const; |
43 CubicBezierTimingFunction::EaseType getKeyframeEaseTypeForTesting(unsigned l
ong index) const; | 44 CubicBezierTimingFunction::EaseType getKeyframeEaseTypeForTesting(unsigned l
ong index) const; |
44 bool keyframeHasLinearTimingFunctionForTesting(unsigned long index) const; | 45 bool keyframeHasLinearTimingFunctionForTesting(unsigned long index) const; |
45 | 46 |
46 void addLinearKeyframe(const CompositorFloatKeyframe&); | 47 void addLinearKeyframe(const CompositorFloatKeyframe&); |
47 void addCubicBezierKeyframe(const CompositorFloatKeyframe&, CubicBezierTimin
gFunction::EaseType); | 48 void addCubicBezierKeyframe(const CompositorFloatKeyframe&, CubicBezierTimin
gFunction::EaseType); |
(...skipping 15 matching lines...) Expand all Loading... |
63 private: | 64 private: |
64 CompositorFloatAnimationCurve(); | 65 CompositorFloatAnimationCurve(); |
65 CompositorFloatAnimationCurve(std::unique_ptr<cc::KeyframedFloatAnimationCur
ve>); | 66 CompositorFloatAnimationCurve(std::unique_ptr<cc::KeyframedFloatAnimationCur
ve>); |
66 | 67 |
67 std::unique_ptr<cc::KeyframedFloatAnimationCurve> m_curve; | 68 std::unique_ptr<cc::KeyframedFloatAnimationCurve> m_curve; |
68 }; | 69 }; |
69 | 70 |
70 } // namespace blink | 71 } // namespace blink |
71 | 72 |
72 #endif // CompositorFloatAnimationCurve_h | 73 #endif // CompositorFloatAnimationCurve_h |
OLD | NEW |