| 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 // Temporary forwarding header |
| 6 #define CCKeyframedAnimationCurve_h | 6 #include "cc/keyframed_animation_curve.h" |
| 7 | |
| 8 #include "CCAnimationCurve.h" | |
| 9 #include "CCTimingFunction.h" | |
| 10 #include "scoped_ptr_vector.h" | |
| 11 #include <public/WebTransformOperations.h> | |
| 12 | |
| 13 namespace cc { | |
| 14 | |
| 15 class CCKeyframe { | |
| 16 public: | |
| 17 double time() const; | |
| 18 const CCTimingFunction* timingFunction() const; | |
| 19 | |
| 20 protected: | |
| 21 CCKeyframe(double time, scoped_ptr<CCTimingFunction>); | |
| 22 virtual ~CCKeyframe(); | |
| 23 | |
| 24 private: | |
| 25 double m_time; | |
| 26 scoped_ptr<CCTimingFunction> m_timingFunction; | |
| 27 }; | |
| 28 | |
| 29 class CCFloatKeyframe : public CCKeyframe { | |
| 30 public: | |
| 31 static scoped_ptr<CCFloatKeyframe> create(double time, float value, scoped_p
tr<CCTimingFunction>); | |
| 32 virtual ~CCFloatKeyframe(); | |
| 33 | |
| 34 float value() const; | |
| 35 | |
| 36 scoped_ptr<CCFloatKeyframe> clone() const; | |
| 37 | |
| 38 private: | |
| 39 CCFloatKeyframe(double time, float value, scoped_ptr<CCTimingFunction>); | |
| 40 | |
| 41 float m_value; | |
| 42 }; | |
| 43 | |
| 44 class CCTransformKeyframe : public CCKeyframe { | |
| 45 public: | |
| 46 static scoped_ptr<CCTransformKeyframe> create(double time, const WebKit::Web
TransformOperations& value, scoped_ptr<CCTimingFunction>); | |
| 47 virtual ~CCTransformKeyframe(); | |
| 48 | |
| 49 const WebKit::WebTransformOperations& value() const; | |
| 50 | |
| 51 scoped_ptr<CCTransformKeyframe> clone() const; | |
| 52 | |
| 53 private: | |
| 54 CCTransformKeyframe(double time, const WebKit::WebTransformOperations& value
, scoped_ptr<CCTimingFunction>); | |
| 55 | |
| 56 WebKit::WebTransformOperations m_value; | |
| 57 }; | |
| 58 | |
| 59 class CCKeyframedFloatAnimationCurve : public CCFloatAnimationCurve { | |
| 60 public: | |
| 61 // It is required that the keyframes be sorted by time. | |
| 62 static scoped_ptr<CCKeyframedFloatAnimationCurve> create(); | |
| 63 | |
| 64 virtual ~CCKeyframedFloatAnimationCurve(); | |
| 65 | |
| 66 void addKeyframe(scoped_ptr<CCFloatKeyframe>); | |
| 67 | |
| 68 // CCAnimationCurve implementation | |
| 69 virtual double duration() const OVERRIDE; | |
| 70 virtual scoped_ptr<CCAnimationCurve> clone() const OVERRIDE; | |
| 71 | |
| 72 // CCFloatAnimationCurve implementation | |
| 73 virtual float getValue(double t) const OVERRIDE; | |
| 74 | |
| 75 private: | |
| 76 CCKeyframedFloatAnimationCurve(); | |
| 77 | |
| 78 // Always sorted in order of increasing time. No two keyframes have the | |
| 79 // same time. | |
| 80 ScopedPtrVector<CCFloatKeyframe> m_keyframes; | |
| 81 }; | |
| 82 | |
| 83 class CCKeyframedTransformAnimationCurve : public CCTransformAnimationCurve { | |
| 84 public: | |
| 85 // It is required that the keyframes be sorted by time. | |
| 86 static scoped_ptr<CCKeyframedTransformAnimationCurve> create(); | |
| 87 | |
| 88 virtual ~CCKeyframedTransformAnimationCurve(); | |
| 89 | |
| 90 void addKeyframe(scoped_ptr<CCTransformKeyframe>); | |
| 91 | |
| 92 // CCAnimationCurve implementation | |
| 93 virtual double duration() const OVERRIDE; | |
| 94 virtual scoped_ptr<CCAnimationCurve> clone() const OVERRIDE; | |
| 95 | |
| 96 // CCTransformAnimationCurve implementation | |
| 97 virtual WebKit::WebTransformationMatrix getValue(double t) const OVERRIDE; | |
| 98 | |
| 99 private: | |
| 100 CCKeyframedTransformAnimationCurve(); | |
| 101 | |
| 102 // Always sorted in order of increasing time. No two keyframes have the | |
| 103 // same time. | |
| 104 ScopedPtrVector<CCTransformKeyframe> m_keyframes; | |
| 105 }; | |
| 106 | |
| 107 } // namespace cc | |
| 108 | |
| 109 #endif // CCKeyframedAnimationCurve_h | |
| OLD | NEW |