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 CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_ | 5 #ifndef CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_ |
6 #define CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_ | 6 #define CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_ |
7 | 7 |
8 #include "cc/animation/animation_curve.h" | 8 #include "cc/animation/animation_curve.h" |
9 #include "cc/animation/timing_function.h" | 9 #include "cc/animation/timing_function.h" |
10 #include "cc/animation/transform_operations.h" | 10 #include "cc/animation/transform_operations.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 DISALLOW_COPY_AND_ASSIGN(Keyframe); | 31 DISALLOW_COPY_AND_ASSIGN(Keyframe); |
32 }; | 32 }; |
33 | 33 |
34 class CC_EXPORT ColorKeyframe : public Keyframe { | 34 class CC_EXPORT ColorKeyframe : public Keyframe { |
35 public: | 35 public: |
36 static scoped_ptr<ColorKeyframe> Create( | 36 static scoped_ptr<ColorKeyframe> Create( |
37 double time, | 37 double time, |
38 SkColor value, | 38 SkColor value, |
39 scoped_ptr<TimingFunction> timing_function); | 39 scoped_ptr<TimingFunction> timing_function); |
40 virtual ~ColorKeyframe(); | 40 ~ColorKeyframe() override; |
41 | 41 |
42 SkColor Value() const; | 42 SkColor Value() const; |
43 | 43 |
44 scoped_ptr<ColorKeyframe> Clone() const; | 44 scoped_ptr<ColorKeyframe> Clone() const; |
45 | 45 |
46 private: | 46 private: |
47 ColorKeyframe(double time, | 47 ColorKeyframe(double time, |
48 SkColor value, | 48 SkColor value, |
49 scoped_ptr<TimingFunction> timing_function); | 49 scoped_ptr<TimingFunction> timing_function); |
50 | 50 |
51 SkColor value_; | 51 SkColor value_; |
52 }; | 52 }; |
53 | 53 |
54 class CC_EXPORT FloatKeyframe : public Keyframe { | 54 class CC_EXPORT FloatKeyframe : public Keyframe { |
55 public: | 55 public: |
56 static scoped_ptr<FloatKeyframe> Create( | 56 static scoped_ptr<FloatKeyframe> Create( |
57 double time, | 57 double time, |
58 float value, | 58 float value, |
59 scoped_ptr<TimingFunction> timing_function); | 59 scoped_ptr<TimingFunction> timing_function); |
60 virtual ~FloatKeyframe(); | 60 ~FloatKeyframe() override; |
61 | 61 |
62 float Value() const; | 62 float Value() const; |
63 | 63 |
64 scoped_ptr<FloatKeyframe> Clone() const; | 64 scoped_ptr<FloatKeyframe> Clone() const; |
65 | 65 |
66 private: | 66 private: |
67 FloatKeyframe(double time, | 67 FloatKeyframe(double time, |
68 float value, | 68 float value, |
69 scoped_ptr<TimingFunction> timing_function); | 69 scoped_ptr<TimingFunction> timing_function); |
70 | 70 |
71 float value_; | 71 float value_; |
72 }; | 72 }; |
73 | 73 |
74 class CC_EXPORT TransformKeyframe : public Keyframe { | 74 class CC_EXPORT TransformKeyframe : public Keyframe { |
75 public: | 75 public: |
76 static scoped_ptr<TransformKeyframe> Create( | 76 static scoped_ptr<TransformKeyframe> Create( |
77 double time, | 77 double time, |
78 const TransformOperations& value, | 78 const TransformOperations& value, |
79 scoped_ptr<TimingFunction> timing_function); | 79 scoped_ptr<TimingFunction> timing_function); |
80 virtual ~TransformKeyframe(); | 80 ~TransformKeyframe() override; |
81 | 81 |
82 const TransformOperations& Value() const; | 82 const TransformOperations& Value() const; |
83 | 83 |
84 scoped_ptr<TransformKeyframe> Clone() const; | 84 scoped_ptr<TransformKeyframe> Clone() const; |
85 | 85 |
86 private: | 86 private: |
87 TransformKeyframe( | 87 TransformKeyframe( |
88 double time, | 88 double time, |
89 const TransformOperations& value, | 89 const TransformOperations& value, |
90 scoped_ptr<TimingFunction> timing_function); | 90 scoped_ptr<TimingFunction> timing_function); |
91 | 91 |
92 TransformOperations value_; | 92 TransformOperations value_; |
93 }; | 93 }; |
94 | 94 |
95 class CC_EXPORT FilterKeyframe : public Keyframe { | 95 class CC_EXPORT FilterKeyframe : public Keyframe { |
96 public: | 96 public: |
97 static scoped_ptr<FilterKeyframe> Create( | 97 static scoped_ptr<FilterKeyframe> Create( |
98 double time, | 98 double time, |
99 const FilterOperations& value, | 99 const FilterOperations& value, |
100 scoped_ptr<TimingFunction> timing_function); | 100 scoped_ptr<TimingFunction> timing_function); |
101 virtual ~FilterKeyframe(); | 101 ~FilterKeyframe() override; |
102 | 102 |
103 const FilterOperations& Value() const; | 103 const FilterOperations& Value() const; |
104 | 104 |
105 scoped_ptr<FilterKeyframe> Clone() const; | 105 scoped_ptr<FilterKeyframe> Clone() const; |
106 | 106 |
107 private: | 107 private: |
108 FilterKeyframe( | 108 FilterKeyframe( |
109 double time, | 109 double time, |
110 const FilterOperations& value, | 110 const FilterOperations& value, |
111 scoped_ptr<TimingFunction> timing_function); | 111 scoped_ptr<TimingFunction> timing_function); |
112 | 112 |
113 FilterOperations value_; | 113 FilterOperations value_; |
114 }; | 114 }; |
115 | 115 |
116 class CC_EXPORT KeyframedColorAnimationCurve : public ColorAnimationCurve { | 116 class CC_EXPORT KeyframedColorAnimationCurve : public ColorAnimationCurve { |
117 public: | 117 public: |
118 // It is required that the keyframes be sorted by time. | 118 // It is required that the keyframes be sorted by time. |
119 static scoped_ptr<KeyframedColorAnimationCurve> Create(); | 119 static scoped_ptr<KeyframedColorAnimationCurve> Create(); |
120 | 120 |
121 virtual ~KeyframedColorAnimationCurve(); | 121 ~KeyframedColorAnimationCurve() override; |
122 | 122 |
123 void AddKeyframe(scoped_ptr<ColorKeyframe> keyframe); | 123 void AddKeyframe(scoped_ptr<ColorKeyframe> keyframe); |
124 void SetTimingFunction(scoped_ptr<TimingFunction> timing_function) { | 124 void SetTimingFunction(scoped_ptr<TimingFunction> timing_function) { |
125 timing_function_ = timing_function.Pass(); | 125 timing_function_ = timing_function.Pass(); |
126 } | 126 } |
127 | 127 |
128 // AnimationCurve implementation | 128 // AnimationCurve implementation |
129 virtual double Duration() const override; | 129 double Duration() const override; |
130 virtual scoped_ptr<AnimationCurve> Clone() const override; | 130 scoped_ptr<AnimationCurve> Clone() const override; |
131 | 131 |
132 // BackgrounColorAnimationCurve implementation | 132 // BackgrounColorAnimationCurve implementation |
133 virtual SkColor GetValue(double t) const override; | 133 SkColor GetValue(double t) const override; |
134 | 134 |
135 private: | 135 private: |
136 KeyframedColorAnimationCurve(); | 136 KeyframedColorAnimationCurve(); |
137 | 137 |
138 // Always sorted in order of increasing time. No two keyframes have the | 138 // Always sorted in order of increasing time. No two keyframes have the |
139 // same time. | 139 // same time. |
140 ScopedPtrVector<ColorKeyframe> keyframes_; | 140 ScopedPtrVector<ColorKeyframe> keyframes_; |
141 scoped_ptr<TimingFunction> timing_function_; | 141 scoped_ptr<TimingFunction> timing_function_; |
142 | 142 |
143 DISALLOW_COPY_AND_ASSIGN(KeyframedColorAnimationCurve); | 143 DISALLOW_COPY_AND_ASSIGN(KeyframedColorAnimationCurve); |
144 }; | 144 }; |
145 | 145 |
146 class CC_EXPORT KeyframedFloatAnimationCurve : public FloatAnimationCurve { | 146 class CC_EXPORT KeyframedFloatAnimationCurve : public FloatAnimationCurve { |
147 public: | 147 public: |
148 // It is required that the keyframes be sorted by time. | 148 // It is required that the keyframes be sorted by time. |
149 static scoped_ptr<KeyframedFloatAnimationCurve> Create(); | 149 static scoped_ptr<KeyframedFloatAnimationCurve> Create(); |
150 | 150 |
151 virtual ~KeyframedFloatAnimationCurve(); | 151 ~KeyframedFloatAnimationCurve() override; |
152 | 152 |
153 void AddKeyframe(scoped_ptr<FloatKeyframe> keyframe); | 153 void AddKeyframe(scoped_ptr<FloatKeyframe> keyframe); |
154 void SetTimingFunction(scoped_ptr<TimingFunction> timing_function) { | 154 void SetTimingFunction(scoped_ptr<TimingFunction> timing_function) { |
155 timing_function_ = timing_function.Pass(); | 155 timing_function_ = timing_function.Pass(); |
156 } | 156 } |
157 | 157 |
158 // AnimationCurve implementation | 158 // AnimationCurve implementation |
159 virtual double Duration() const override; | 159 double Duration() const override; |
160 virtual scoped_ptr<AnimationCurve> Clone() const override; | 160 scoped_ptr<AnimationCurve> Clone() const override; |
161 | 161 |
162 // FloatAnimationCurve implementation | 162 // FloatAnimationCurve implementation |
163 virtual float GetValue(double t) const override; | 163 float GetValue(double t) const override; |
164 | 164 |
165 private: | 165 private: |
166 KeyframedFloatAnimationCurve(); | 166 KeyframedFloatAnimationCurve(); |
167 | 167 |
168 // Always sorted in order of increasing time. No two keyframes have the | 168 // Always sorted in order of increasing time. No two keyframes have the |
169 // same time. | 169 // same time. |
170 ScopedPtrVector<FloatKeyframe> keyframes_; | 170 ScopedPtrVector<FloatKeyframe> keyframes_; |
171 scoped_ptr<TimingFunction> timing_function_; | 171 scoped_ptr<TimingFunction> timing_function_; |
172 | 172 |
173 DISALLOW_COPY_AND_ASSIGN(KeyframedFloatAnimationCurve); | 173 DISALLOW_COPY_AND_ASSIGN(KeyframedFloatAnimationCurve); |
174 }; | 174 }; |
175 | 175 |
176 class CC_EXPORT KeyframedTransformAnimationCurve | 176 class CC_EXPORT KeyframedTransformAnimationCurve |
177 : public TransformAnimationCurve { | 177 : public TransformAnimationCurve { |
178 public: | 178 public: |
179 // It is required that the keyframes be sorted by time. | 179 // It is required that the keyframes be sorted by time. |
180 static scoped_ptr<KeyframedTransformAnimationCurve> Create(); | 180 static scoped_ptr<KeyframedTransformAnimationCurve> Create(); |
181 | 181 |
182 virtual ~KeyframedTransformAnimationCurve(); | 182 ~KeyframedTransformAnimationCurve() override; |
183 | 183 |
184 void AddKeyframe(scoped_ptr<TransformKeyframe> keyframe); | 184 void AddKeyframe(scoped_ptr<TransformKeyframe> keyframe); |
185 void SetTimingFunction(scoped_ptr<TimingFunction> timing_function) { | 185 void SetTimingFunction(scoped_ptr<TimingFunction> timing_function) { |
186 timing_function_ = timing_function.Pass(); | 186 timing_function_ = timing_function.Pass(); |
187 } | 187 } |
188 | 188 |
189 // AnimationCurve implementation | 189 // AnimationCurve implementation |
190 virtual double Duration() const override; | 190 double Duration() const override; |
191 virtual scoped_ptr<AnimationCurve> Clone() const override; | 191 scoped_ptr<AnimationCurve> Clone() const override; |
192 | 192 |
193 // TransformAnimationCurve implementation | 193 // TransformAnimationCurve implementation |
194 virtual gfx::Transform GetValue(double t) const override; | 194 gfx::Transform GetValue(double t) const override; |
195 virtual bool AnimatedBoundsForBox(const gfx::BoxF& box, | 195 bool AnimatedBoundsForBox(const gfx::BoxF& box, |
196 gfx::BoxF* bounds) const override; | 196 gfx::BoxF* bounds) const override; |
197 virtual bool AffectsScale() const override; | 197 bool AffectsScale() const override; |
198 virtual bool IsTranslation() const override; | 198 bool IsTranslation() const override; |
199 virtual bool MaximumTargetScale(bool forward_direction, | 199 bool MaximumTargetScale(bool forward_direction, |
200 float* max_scale) const override; | 200 float* max_scale) const override; |
201 | 201 |
202 private: | 202 private: |
203 KeyframedTransformAnimationCurve(); | 203 KeyframedTransformAnimationCurve(); |
204 | 204 |
205 // Always sorted in order of increasing time. No two keyframes have the | 205 // Always sorted in order of increasing time. No two keyframes have the |
206 // same time. | 206 // same time. |
207 ScopedPtrVector<TransformKeyframe> keyframes_; | 207 ScopedPtrVector<TransformKeyframe> keyframes_; |
208 scoped_ptr<TimingFunction> timing_function_; | 208 scoped_ptr<TimingFunction> timing_function_; |
209 | 209 |
210 DISALLOW_COPY_AND_ASSIGN(KeyframedTransformAnimationCurve); | 210 DISALLOW_COPY_AND_ASSIGN(KeyframedTransformAnimationCurve); |
211 }; | 211 }; |
212 | 212 |
213 class CC_EXPORT KeyframedFilterAnimationCurve | 213 class CC_EXPORT KeyframedFilterAnimationCurve |
214 : public FilterAnimationCurve { | 214 : public FilterAnimationCurve { |
215 public: | 215 public: |
216 // It is required that the keyframes be sorted by time. | 216 // It is required that the keyframes be sorted by time. |
217 static scoped_ptr<KeyframedFilterAnimationCurve> Create(); | 217 static scoped_ptr<KeyframedFilterAnimationCurve> Create(); |
218 | 218 |
219 virtual ~KeyframedFilterAnimationCurve(); | 219 ~KeyframedFilterAnimationCurve() override; |
220 | 220 |
221 void AddKeyframe(scoped_ptr<FilterKeyframe> keyframe); | 221 void AddKeyframe(scoped_ptr<FilterKeyframe> keyframe); |
222 void SetTimingFunction(scoped_ptr<TimingFunction> timing_function) { | 222 void SetTimingFunction(scoped_ptr<TimingFunction> timing_function) { |
223 timing_function_ = timing_function.Pass(); | 223 timing_function_ = timing_function.Pass(); |
224 } | 224 } |
225 | 225 |
226 // AnimationCurve implementation | 226 // AnimationCurve implementation |
227 virtual double Duration() const override; | 227 double Duration() const override; |
228 virtual scoped_ptr<AnimationCurve> Clone() const override; | 228 scoped_ptr<AnimationCurve> Clone() const override; |
229 | 229 |
230 // FilterAnimationCurve implementation | 230 // FilterAnimationCurve implementation |
231 virtual FilterOperations GetValue(double t) const override; | 231 FilterOperations GetValue(double t) const override; |
232 virtual bool HasFilterThatMovesPixels() const override; | 232 bool HasFilterThatMovesPixels() const override; |
233 | 233 |
234 private: | 234 private: |
235 KeyframedFilterAnimationCurve(); | 235 KeyframedFilterAnimationCurve(); |
236 | 236 |
237 // Always sorted in order of increasing time. No two keyframes have the | 237 // Always sorted in order of increasing time. No two keyframes have the |
238 // same time. | 238 // same time. |
239 ScopedPtrVector<FilterKeyframe> keyframes_; | 239 ScopedPtrVector<FilterKeyframe> keyframes_; |
240 scoped_ptr<TimingFunction> timing_function_; | 240 scoped_ptr<TimingFunction> timing_function_; |
241 | 241 |
242 DISALLOW_COPY_AND_ASSIGN(KeyframedFilterAnimationCurve); | 242 DISALLOW_COPY_AND_ASSIGN(KeyframedFilterAnimationCurve); |
243 }; | 243 }; |
244 | 244 |
245 } // namespace cc | 245 } // namespace cc |
246 | 246 |
247 #endif // CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_ | 247 #endif // CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_ |
OLD | NEW |