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