| 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 CompositorTransformAnimationCurve_h | 5 #ifndef CompositorTransformAnimationCurve_h |
| 6 #define CompositorTransformAnimationCurve_h | 6 #define CompositorTransformAnimationCurve_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/CompositorTransformKeyframe.h" | 10 #include "platform/animation/CompositorTransformKeyframe.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 <memory> | |
| 15 | 14 |
| 16 namespace cc { | 15 namespace cc { |
| 17 class KeyframedTransformAnimationCurve; | 16 class KeyframedTransformAnimationCurve; |
| 18 } | 17 } |
| 19 | 18 |
| 20 namespace blink { | 19 namespace blink { |
| 21 class CompositorTransformKeyframe; | 20 class CompositorTransformKeyframe; |
| 22 } | 21 } |
| 23 | 22 |
| 24 namespace blink { | 23 namespace blink { |
| 25 | 24 |
| 26 // A keyframed transform animation curve. | 25 // A keyframed transform animation curve. |
| 27 class PLATFORM_EXPORT CompositorTransformAnimationCurve : public CompositorAnima
tionCurve { | 26 class PLATFORM_EXPORT CompositorTransformAnimationCurve : public CompositorAnima
tionCurve { |
| 28 WTF_MAKE_NONCOPYABLE(CompositorTransformAnimationCurve); | 27 WTF_MAKE_NONCOPYABLE(CompositorTransformAnimationCurve); |
| 29 public: | 28 public: |
| 30 static std::unique_ptr<CompositorTransformAnimationCurve> create() | 29 static PassOwnPtr<CompositorTransformAnimationCurve> create() |
| 31 { | 30 { |
| 32 return wrapUnique(new CompositorTransformAnimationCurve()); | 31 return adoptPtr(new CompositorTransformAnimationCurve()); |
| 33 } | 32 } |
| 34 | 33 |
| 35 ~CompositorTransformAnimationCurve() override; | 34 ~CompositorTransformAnimationCurve() override; |
| 36 | 35 |
| 37 void addLinearKeyframe(const CompositorTransformKeyframe&); | 36 void addLinearKeyframe(const CompositorTransformKeyframe&); |
| 38 void addCubicBezierKeyframe(const CompositorTransformKeyframe&, CubicBezierT
imingFunction::EaseType); | 37 void addCubicBezierKeyframe(const CompositorTransformKeyframe&, CubicBezierT
imingFunction::EaseType); |
| 39 // Adds the keyframe with a custom, bezier timing function. Note, it is | 38 // Adds the keyframe with a custom, bezier timing function. Note, it is |
| 40 // assumed that x0 = y0, and x3 = y3 = 1. | 39 // assumed that x0 = y0, and x3 = y3 = 1. |
| 41 void addCubicBezierKeyframe(const CompositorTransformKeyframe&, double x1, d
ouble y1, double x2, double y2); | 40 void addCubicBezierKeyframe(const CompositorTransformKeyframe&, double x1, d
ouble y1, double x2, double y2); |
| 42 void addStepsKeyframe(const CompositorTransformKeyframe&, int steps, StepsTi
mingFunction::StepPosition); | 41 void addStepsKeyframe(const CompositorTransformKeyframe&, int steps, StepsTi
mingFunction::StepPosition); |
| 43 | 42 |
| 44 void setLinearTimingFunction(); | 43 void setLinearTimingFunction(); |
| 45 void setCubicBezierTimingFunction(CubicBezierTimingFunction::EaseType); | 44 void setCubicBezierTimingFunction(CubicBezierTimingFunction::EaseType); |
| 46 void setCubicBezierTimingFunction(double x1, double y1, double x2, double y2
); | 45 void setCubicBezierTimingFunction(double x1, double y1, double x2, double y2
); |
| 47 void setStepsTimingFunction(int numberOfSteps, StepsTimingFunction::StepPosi
tion); | 46 void setStepsTimingFunction(int numberOfSteps, StepsTimingFunction::StepPosi
tion); |
| 48 | 47 |
| 49 // CompositorAnimationCurve implementation. | 48 // CompositorAnimationCurve implementation. |
| 50 std::unique_ptr<cc::AnimationCurve> cloneToAnimationCurve() const override; | 49 std::unique_ptr<cc::AnimationCurve> cloneToAnimationCurve() const override; |
| 51 | 50 |
| 52 private: | 51 private: |
| 53 CompositorTransformAnimationCurve(); | 52 CompositorTransformAnimationCurve(); |
| 54 | 53 |
| 55 std::unique_ptr<cc::KeyframedTransformAnimationCurve> m_curve; | 54 std::unique_ptr<cc::KeyframedTransformAnimationCurve> m_curve; |
| 56 }; | 55 }; |
| 57 | 56 |
| 58 } // namespace blink | 57 } // namespace blink |
| 59 | 58 |
| 60 #endif // CompositorTransformAnimationCurve_h | 59 #endif // CompositorTransformAnimationCurve_h |
| OLD | NEW |