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