| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 CCKeyframedAnimationCurve_h | 5 #ifndef CCKeyframedAnimationCurve_h |
| 6 #define CCKeyframedAnimationCurve_h | 6 #define CCKeyframedAnimationCurve_h |
| 7 | 7 |
| 8 #include "cc/animation_curve.h" | 8 #include "cc/animation_curve.h" |
| 9 #include "cc/cc_export.h" |
| 9 #include "cc/scoped_ptr_vector.h" | 10 #include "cc/scoped_ptr_vector.h" |
| 10 #include "cc/timing_function.h" | 11 #include "cc/timing_function.h" |
| 11 #include <public/WebTransformOperations.h> | 12 #include <public/WebTransformOperations.h> |
| 12 | 13 |
| 13 namespace cc { | 14 namespace cc { |
| 14 | 15 |
| 15 class Keyframe { | 16 class CC_EXPORT Keyframe { |
| 16 public: | 17 public: |
| 17 double time() const; | 18 double time() const; |
| 18 const TimingFunction* timingFunction() const; | 19 const TimingFunction* timingFunction() const; |
| 19 | 20 |
| 20 protected: | 21 protected: |
| 21 Keyframe(double time, scoped_ptr<TimingFunction>); | 22 Keyframe(double time, scoped_ptr<TimingFunction>); |
| 22 virtual ~Keyframe(); | 23 virtual ~Keyframe(); |
| 23 | 24 |
| 24 private: | 25 private: |
| 25 double m_time; | 26 double m_time; |
| 26 scoped_ptr<TimingFunction> m_timingFunction; | 27 scoped_ptr<TimingFunction> m_timingFunction; |
| 28 |
| 29 DISALLOW_COPY_AND_ASSIGN(Keyframe); |
| 27 }; | 30 }; |
| 28 | 31 |
| 29 class FloatKeyframe : public Keyframe { | 32 class CC_EXPORT FloatKeyframe : public Keyframe { |
| 30 public: | 33 public: |
| 31 static scoped_ptr<FloatKeyframe> create(double time, float value, scoped_ptr
<TimingFunction>); | 34 static scoped_ptr<FloatKeyframe> create(double time, float value, scoped_ptr
<TimingFunction>); |
| 32 virtual ~FloatKeyframe(); | 35 virtual ~FloatKeyframe(); |
| 33 | 36 |
| 34 float value() const; | 37 float value() const; |
| 35 | 38 |
| 36 scoped_ptr<FloatKeyframe> clone() const; | 39 scoped_ptr<FloatKeyframe> clone() const; |
| 37 | 40 |
| 38 private: | 41 private: |
| 39 FloatKeyframe(double time, float value, scoped_ptr<TimingFunction>); | 42 FloatKeyframe(double time, float value, scoped_ptr<TimingFunction>); |
| 40 | 43 |
| 41 float m_value; | 44 float m_value; |
| 42 }; | 45 }; |
| 43 | 46 |
| 44 class TransformKeyframe : public Keyframe { | 47 class CC_EXPORT TransformKeyframe : public Keyframe { |
| 45 public: | 48 public: |
| 46 static scoped_ptr<TransformKeyframe> create(double time, const WebKit::WebTr
ansformOperations& value, scoped_ptr<TimingFunction>); | 49 static scoped_ptr<TransformKeyframe> create(double time, const WebKit::WebTr
ansformOperations& value, scoped_ptr<TimingFunction>); |
| 47 virtual ~TransformKeyframe(); | 50 virtual ~TransformKeyframe(); |
| 48 | 51 |
| 49 const WebKit::WebTransformOperations& value() const; | 52 const WebKit::WebTransformOperations& value() const; |
| 50 | 53 |
| 51 scoped_ptr<TransformKeyframe> clone() const; | 54 scoped_ptr<TransformKeyframe> clone() const; |
| 52 | 55 |
| 53 private: | 56 private: |
| 54 TransformKeyframe(double time, const WebKit::WebTransformOperations& value,
scoped_ptr<TimingFunction>); | 57 TransformKeyframe(double time, const WebKit::WebTransformOperations& value,
scoped_ptr<TimingFunction>); |
| 55 | 58 |
| 56 WebKit::WebTransformOperations m_value; | 59 WebKit::WebTransformOperations m_value; |
| 57 }; | 60 }; |
| 58 | 61 |
| 59 class KeyframedFloatAnimationCurve : public FloatAnimationCurve { | 62 class CC_EXPORT KeyframedFloatAnimationCurve : public FloatAnimationCurve { |
| 60 public: | 63 public: |
| 61 // It is required that the keyframes be sorted by time. | 64 // It is required that the keyframes be sorted by time. |
| 62 static scoped_ptr<KeyframedFloatAnimationCurve> create(); | 65 static scoped_ptr<KeyframedFloatAnimationCurve> create(); |
| 63 | 66 |
| 64 virtual ~KeyframedFloatAnimationCurve(); | 67 virtual ~KeyframedFloatAnimationCurve(); |
| 65 | 68 |
| 66 void addKeyframe(scoped_ptr<FloatKeyframe>); | 69 void addKeyframe(scoped_ptr<FloatKeyframe>); |
| 67 | 70 |
| 68 // AnimationCurve implementation | 71 // AnimationCurve implementation |
| 69 virtual double duration() const OVERRIDE; | 72 virtual double duration() const OVERRIDE; |
| 70 virtual scoped_ptr<AnimationCurve> clone() const OVERRIDE; | 73 virtual scoped_ptr<AnimationCurve> clone() const OVERRIDE; |
| 71 | 74 |
| 72 // FloatAnimationCurve implementation | 75 // FloatAnimationCurve implementation |
| 73 virtual float getValue(double t) const OVERRIDE; | 76 virtual float getValue(double t) const OVERRIDE; |
| 74 | 77 |
| 75 private: | 78 private: |
| 76 KeyframedFloatAnimationCurve(); | 79 KeyframedFloatAnimationCurve(); |
| 77 | 80 |
| 78 // Always sorted in order of increasing time. No two keyframes have the | 81 // Always sorted in order of increasing time. No two keyframes have the |
| 79 // same time. | 82 // same time. |
| 80 ScopedPtrVector<FloatKeyframe> m_keyframes; | 83 ScopedPtrVector<FloatKeyframe> m_keyframes; |
| 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(KeyframedFloatAnimationCurve); |
| 81 }; | 86 }; |
| 82 | 87 |
| 83 class KeyframedTransformAnimationCurve : public TransformAnimationCurve { | 88 class CC_EXPORT KeyframedTransformAnimationCurve : public TransformAnimationCurv
e { |
| 84 public: | 89 public: |
| 85 // It is required that the keyframes be sorted by time. | 90 // It is required that the keyframes be sorted by time. |
| 86 static scoped_ptr<KeyframedTransformAnimationCurve> create(); | 91 static scoped_ptr<KeyframedTransformAnimationCurve> create(); |
| 87 | 92 |
| 88 virtual ~KeyframedTransformAnimationCurve(); | 93 virtual ~KeyframedTransformAnimationCurve(); |
| 89 | 94 |
| 90 void addKeyframe(scoped_ptr<TransformKeyframe>); | 95 void addKeyframe(scoped_ptr<TransformKeyframe>); |
| 91 | 96 |
| 92 // AnimationCurve implementation | 97 // AnimationCurve implementation |
| 93 virtual double duration() const OVERRIDE; | 98 virtual double duration() const OVERRIDE; |
| 94 virtual scoped_ptr<AnimationCurve> clone() const OVERRIDE; | 99 virtual scoped_ptr<AnimationCurve> clone() const OVERRIDE; |
| 95 | 100 |
| 96 // TransformAnimationCurve implementation | 101 // TransformAnimationCurve implementation |
| 97 virtual WebKit::WebTransformationMatrix getValue(double t) const OVERRIDE; | 102 virtual WebKit::WebTransformationMatrix getValue(double t) const OVERRIDE; |
| 98 | 103 |
| 99 private: | 104 private: |
| 100 KeyframedTransformAnimationCurve(); | 105 KeyframedTransformAnimationCurve(); |
| 101 | 106 |
| 102 // Always sorted in order of increasing time. No two keyframes have the | 107 // Always sorted in order of increasing time. No two keyframes have the |
| 103 // same time. | 108 // same time. |
| 104 ScopedPtrVector<TransformKeyframe> m_keyframes; | 109 ScopedPtrVector<TransformKeyframe> m_keyframes; |
| 110 |
| 111 DISALLOW_COPY_AND_ASSIGN(KeyframedTransformAnimationCurve); |
| 105 }; | 112 }; |
| 106 | 113 |
| 107 } // namespace cc | 114 } // namespace cc |
| 108 | 115 |
| 109 #endif // CCKeyframedAnimationCurve_h | 116 #endif // CCKeyframedAnimationCurve_h |
| OLD | NEW |