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 "base/time/time.h" |
8 #include "cc/animation/animation_curve.h" | 9 #include "cc/animation/animation_curve.h" |
9 #include "cc/animation/timing_function.h" | 10 #include "cc/animation/timing_function.h" |
10 #include "cc/animation/transform_operations.h" | 11 #include "cc/animation/transform_operations.h" |
11 #include "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
12 #include "cc/base/scoped_ptr_vector.h" | 13 #include "cc/base/scoped_ptr_vector.h" |
13 | 14 |
14 namespace cc { | 15 namespace cc { |
15 | 16 |
16 class CC_EXPORT Keyframe { | 17 class CC_EXPORT Keyframe { |
17 public: | 18 public: |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 static scoped_ptr<KeyframedColorAnimationCurve> Create(); | 120 static scoped_ptr<KeyframedColorAnimationCurve> Create(); |
120 | 121 |
121 ~KeyframedColorAnimationCurve() override; | 122 ~KeyframedColorAnimationCurve() override; |
122 | 123 |
123 void AddKeyframe(scoped_ptr<ColorKeyframe> keyframe); | 124 void AddKeyframe(scoped_ptr<ColorKeyframe> keyframe); |
124 void SetTimingFunction(scoped_ptr<TimingFunction> timing_function) { | 125 void SetTimingFunction(scoped_ptr<TimingFunction> timing_function) { |
125 timing_function_ = timing_function.Pass(); | 126 timing_function_ = timing_function.Pass(); |
126 } | 127 } |
127 | 128 |
128 // AnimationCurve implementation | 129 // AnimationCurve implementation |
129 double Duration() const override; | 130 base::TimeDelta Duration() const override; |
130 scoped_ptr<AnimationCurve> Clone() const override; | 131 scoped_ptr<AnimationCurve> Clone() const override; |
131 | 132 |
132 // BackgrounColorAnimationCurve implementation | 133 // BackgrounColorAnimationCurve implementation |
133 SkColor GetValue(double t) const override; | 134 SkColor GetValue(double t) const override; |
134 | 135 |
135 private: | 136 private: |
136 KeyframedColorAnimationCurve(); | 137 KeyframedColorAnimationCurve(); |
137 | 138 |
138 // Always sorted in order of increasing time. No two keyframes have the | 139 // Always sorted in order of increasing time. No two keyframes have the |
139 // same time. | 140 // same time. |
140 ScopedPtrVector<ColorKeyframe> keyframes_; | 141 ScopedPtrVector<ColorKeyframe> keyframes_; |
141 scoped_ptr<TimingFunction> timing_function_; | 142 scoped_ptr<TimingFunction> timing_function_; |
142 | 143 |
143 DISALLOW_COPY_AND_ASSIGN(KeyframedColorAnimationCurve); | 144 DISALLOW_COPY_AND_ASSIGN(KeyframedColorAnimationCurve); |
144 }; | 145 }; |
145 | 146 |
146 class CC_EXPORT KeyframedFloatAnimationCurve : public FloatAnimationCurve { | 147 class CC_EXPORT KeyframedFloatAnimationCurve : public FloatAnimationCurve { |
147 public: | 148 public: |
148 // It is required that the keyframes be sorted by time. | 149 // It is required that the keyframes be sorted by time. |
149 static scoped_ptr<KeyframedFloatAnimationCurve> Create(); | 150 static scoped_ptr<KeyframedFloatAnimationCurve> Create(); |
150 | 151 |
151 ~KeyframedFloatAnimationCurve() override; | 152 ~KeyframedFloatAnimationCurve() override; |
152 | 153 |
153 void AddKeyframe(scoped_ptr<FloatKeyframe> keyframe); | 154 void AddKeyframe(scoped_ptr<FloatKeyframe> keyframe); |
154 void SetTimingFunction(scoped_ptr<TimingFunction> timing_function) { | 155 void SetTimingFunction(scoped_ptr<TimingFunction> timing_function) { |
155 timing_function_ = timing_function.Pass(); | 156 timing_function_ = timing_function.Pass(); |
156 } | 157 } |
157 | 158 |
158 // AnimationCurve implementation | 159 // AnimationCurve implementation |
159 double Duration() const override; | 160 base::TimeDelta Duration() const override; |
160 scoped_ptr<AnimationCurve> Clone() const override; | 161 scoped_ptr<AnimationCurve> Clone() const override; |
161 | 162 |
162 // FloatAnimationCurve implementation | 163 // FloatAnimationCurve implementation |
163 float GetValue(double t) const override; | 164 float GetValue(double t) const override; |
164 | 165 |
165 private: | 166 private: |
166 KeyframedFloatAnimationCurve(); | 167 KeyframedFloatAnimationCurve(); |
167 | 168 |
168 // Always sorted in order of increasing time. No two keyframes have the | 169 // Always sorted in order of increasing time. No two keyframes have the |
169 // same time. | 170 // same time. |
(...skipping 10 matching lines...) Expand all Loading... |
180 static scoped_ptr<KeyframedTransformAnimationCurve> Create(); | 181 static scoped_ptr<KeyframedTransformAnimationCurve> Create(); |
181 | 182 |
182 ~KeyframedTransformAnimationCurve() override; | 183 ~KeyframedTransformAnimationCurve() override; |
183 | 184 |
184 void AddKeyframe(scoped_ptr<TransformKeyframe> keyframe); | 185 void AddKeyframe(scoped_ptr<TransformKeyframe> keyframe); |
185 void SetTimingFunction(scoped_ptr<TimingFunction> timing_function) { | 186 void SetTimingFunction(scoped_ptr<TimingFunction> timing_function) { |
186 timing_function_ = timing_function.Pass(); | 187 timing_function_ = timing_function.Pass(); |
187 } | 188 } |
188 | 189 |
189 // AnimationCurve implementation | 190 // AnimationCurve implementation |
190 double Duration() const override; | 191 base::TimeDelta Duration() const override; |
191 scoped_ptr<AnimationCurve> Clone() const override; | 192 scoped_ptr<AnimationCurve> Clone() const override; |
192 | 193 |
193 // TransformAnimationCurve implementation | 194 // TransformAnimationCurve implementation |
194 gfx::Transform GetValue(double t) const override; | 195 gfx::Transform GetValue(double t) const override; |
195 bool AnimatedBoundsForBox(const gfx::BoxF& box, | 196 bool AnimatedBoundsForBox(const gfx::BoxF& box, |
196 gfx::BoxF* bounds) const override; | 197 gfx::BoxF* bounds) const override; |
197 bool AffectsScale() const override; | 198 bool AffectsScale() const override; |
198 bool IsTranslation() const override; | 199 bool IsTranslation() const override; |
199 bool MaximumTargetScale(bool forward_direction, | 200 bool MaximumTargetScale(bool forward_direction, |
200 float* max_scale) const override; | 201 float* max_scale) const override; |
(...skipping 16 matching lines...) Expand all Loading... |
217 static scoped_ptr<KeyframedFilterAnimationCurve> Create(); | 218 static scoped_ptr<KeyframedFilterAnimationCurve> Create(); |
218 | 219 |
219 ~KeyframedFilterAnimationCurve() override; | 220 ~KeyframedFilterAnimationCurve() override; |
220 | 221 |
221 void AddKeyframe(scoped_ptr<FilterKeyframe> keyframe); | 222 void AddKeyframe(scoped_ptr<FilterKeyframe> keyframe); |
222 void SetTimingFunction(scoped_ptr<TimingFunction> timing_function) { | 223 void SetTimingFunction(scoped_ptr<TimingFunction> timing_function) { |
223 timing_function_ = timing_function.Pass(); | 224 timing_function_ = timing_function.Pass(); |
224 } | 225 } |
225 | 226 |
226 // AnimationCurve implementation | 227 // AnimationCurve implementation |
227 double Duration() const override; | 228 base::TimeDelta Duration() const override; |
228 scoped_ptr<AnimationCurve> Clone() const override; | 229 scoped_ptr<AnimationCurve> Clone() const override; |
229 | 230 |
230 // FilterAnimationCurve implementation | 231 // FilterAnimationCurve implementation |
231 FilterOperations GetValue(double t) const override; | 232 FilterOperations GetValue(double t) const override; |
232 bool HasFilterThatMovesPixels() const override; | 233 bool HasFilterThatMovesPixels() const override; |
233 | 234 |
234 private: | 235 private: |
235 KeyframedFilterAnimationCurve(); | 236 KeyframedFilterAnimationCurve(); |
236 | 237 |
237 // Always sorted in order of increasing time. No two keyframes have the | 238 // Always sorted in order of increasing time. No two keyframes have the |
238 // same time. | 239 // same time. |
239 ScopedPtrVector<FilterKeyframe> keyframes_; | 240 ScopedPtrVector<FilterKeyframe> keyframes_; |
240 scoped_ptr<TimingFunction> timing_function_; | 241 scoped_ptr<TimingFunction> timing_function_; |
241 | 242 |
242 DISALLOW_COPY_AND_ASSIGN(KeyframedFilterAnimationCurve); | 243 DISALLOW_COPY_AND_ASSIGN(KeyframedFilterAnimationCurve); |
243 }; | 244 }; |
244 | 245 |
245 } // namespace cc | 246 } // namespace cc |
246 | 247 |
247 #endif // CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_ | 248 #endif // CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_ |
OLD | NEW |