| 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/Vector.h" |
| 13 | 14 |
| 14 namespace cc { | 15 namespace cc { |
| 15 class KeyframedFloatAnimationCurve; | 16 class KeyframedFloatAnimationCurve; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace blink { | 19 namespace blink { |
| 19 struct CompositorFloatKeyframe; | 20 struct CompositorFloatKeyframe; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace blink { | 23 namespace blink { |
| 23 | 24 |
| 24 // A keyframed float animation curve. | 25 // A keyframed float animation curve. |
| 25 class PLATFORM_EXPORT CompositorFloatAnimationCurve : public CompositorAnimation
Curve { | 26 class PLATFORM_EXPORT CompositorFloatAnimationCurve : public CompositorAnimation
Curve { |
| 26 WTF_MAKE_NONCOPYABLE(CompositorFloatAnimationCurve); | 27 WTF_MAKE_NONCOPYABLE(CompositorFloatAnimationCurve); |
| 27 public: | 28 public: |
| 28 CompositorFloatAnimationCurve(); | 29 CompositorFloatAnimationCurve(); |
| 29 ~CompositorFloatAnimationCurve() override; | 30 ~CompositorFloatAnimationCurve() override; |
| 30 | 31 |
| 31 virtual void addLinearKeyframe(const CompositorFloatKeyframe&); | 32 static PassOwnPtr<CompositorFloatAnimationCurve> CreateForTesting(std::uniqu
e_ptr<cc::KeyframedFloatAnimationCurve>); |
| 32 virtual void addCubicBezierKeyframe(const CompositorFloatKeyframe&, CubicBez
ierTimingFunction::EaseType); | 33 Vector<CompositorFloatKeyframe> keyframesForTesting() const; |
| 34 |
| 35 // TODO(loyso): Erase these methods once blink/cc timing functions unified. |
| 36 CubicBezierTimingFunction::EaseType getCurveEaseTypeForTesting() const; |
| 37 bool curveHasLinearTimingFunctionForTesting() const; |
| 38 CubicBezierTimingFunction::EaseType getKeyframeEaseTypeForTesting(unsigned l
ong index) const; |
| 39 bool keyframeHasLinearTimingFunctionForTesting(unsigned long index) const; |
| 40 |
| 41 void addLinearKeyframe(const CompositorFloatKeyframe&); |
| 42 void addCubicBezierKeyframe(const CompositorFloatKeyframe&, CubicBezierTimin
gFunction::EaseType); |
| 33 // Adds the keyframe with a custom, bezier timing function. Note, it is | 43 // Adds the keyframe with a custom, bezier timing function. Note, it is |
| 34 // assumed that x0 = y0 , and x3 = y3 = 1. | 44 // assumed that x0 = y0 , and x3 = y3 = 1. |
| 35 virtual void addCubicBezierKeyframe(const CompositorFloatKeyframe&, double x
1, double y1, double x2, double y2); | 45 void addCubicBezierKeyframe(const CompositorFloatKeyframe&, double x1, doubl
e y1, double x2, double y2); |
| 36 virtual void addStepsKeyframe(const CompositorFloatKeyframe&, int steps, Ste
psTimingFunction::StepPosition); | 46 void addStepsKeyframe(const CompositorFloatKeyframe&, int steps, StepsTiming
Function::StepPosition); |
| 37 | 47 |
| 38 virtual void setLinearTimingFunction(); | 48 void setLinearTimingFunction(); |
| 39 virtual void setCubicBezierTimingFunction(CubicBezierTimingFunction::EaseTyp
e); | 49 void setCubicBezierTimingFunction(CubicBezierTimingFunction::EaseType); |
| 40 virtual void setCubicBezierTimingFunction(double x1, double y1, double x2, d
ouble y2); | 50 void setCubicBezierTimingFunction(double x1, double y1, double x2, double y2
); |
| 41 virtual void setStepsTimingFunction(int numberOfSteps, StepsTimingFunction::
StepPosition); | 51 void setStepsTimingFunction(int numberOfSteps, StepsTimingFunction::StepPosi
tion); |
| 42 | 52 |
| 43 virtual float getValue(double time) const; | 53 float getValue(double time) const; |
| 44 | 54 |
| 45 // CompositorAnimationCurve implementation. | 55 // CompositorAnimationCurve implementation. |
| 46 std::unique_ptr<cc::AnimationCurve> cloneToAnimationCurve() const override; | 56 std::unique_ptr<cc::AnimationCurve> cloneToAnimationCurve() const override; |
| 47 | 57 |
| 48 private: | 58 private: |
| 59 CompositorFloatAnimationCurve(std::unique_ptr<cc::KeyframedFloatAnimationCur
ve>); |
| 60 |
| 49 std::unique_ptr<cc::KeyframedFloatAnimationCurve> m_curve; | 61 std::unique_ptr<cc::KeyframedFloatAnimationCurve> m_curve; |
| 50 }; | 62 }; |
| 51 | 63 |
| 52 } // namespace blink | 64 } // namespace blink |
| 53 | 65 |
| 54 #endif // CompositorFloatAnimationCurve_h | 66 #endif // CompositorFloatAnimationCurve_h |
| OLD | NEW |