| 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 <vector> |
| 9 |
| 8 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 9 #include "cc/animation/animation_curve.h" | 11 #include "cc/animation/animation_curve.h" |
| 10 #include "cc/animation/timing_function.h" | 12 #include "cc/animation/timing_function.h" |
| 11 #include "cc/animation/transform_operations.h" | 13 #include "cc/animation/transform_operations.h" |
| 12 #include "cc/base/cc_export.h" | 14 #include "cc/base/cc_export.h" |
| 13 #include "cc/base/scoped_ptr_vector.h" | |
| 14 | 15 |
| 15 namespace cc { | 16 namespace cc { |
| 16 | 17 |
| 17 class CC_EXPORT Keyframe { | 18 class CC_EXPORT Keyframe { |
| 18 public: | 19 public: |
| 19 base::TimeDelta Time() const; | 20 base::TimeDelta Time() const; |
| 20 const TimingFunction* timing_function() const { | 21 const TimingFunction* timing_function() const { |
| 21 return timing_function_.get(); | 22 return timing_function_.get(); |
| 22 } | 23 } |
| 23 | 24 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 scoped_ptr<AnimationCurve> Clone() const override; | 130 scoped_ptr<AnimationCurve> Clone() const override; |
| 130 | 131 |
| 131 // BackgrounColorAnimationCurve implementation | 132 // BackgrounColorAnimationCurve implementation |
| 132 SkColor GetValue(base::TimeDelta t) const override; | 133 SkColor GetValue(base::TimeDelta t) const override; |
| 133 | 134 |
| 134 private: | 135 private: |
| 135 KeyframedColorAnimationCurve(); | 136 KeyframedColorAnimationCurve(); |
| 136 | 137 |
| 137 // 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 |
| 138 // same time. | 139 // same time. |
| 139 ScopedPtrVector<ColorKeyframe> keyframes_; | 140 std::vector<scoped_ptr<ColorKeyframe>> keyframes_; |
| 140 scoped_ptr<TimingFunction> timing_function_; | 141 scoped_ptr<TimingFunction> timing_function_; |
| 141 | 142 |
| 142 DISALLOW_COPY_AND_ASSIGN(KeyframedColorAnimationCurve); | 143 DISALLOW_COPY_AND_ASSIGN(KeyframedColorAnimationCurve); |
| 143 }; | 144 }; |
| 144 | 145 |
| 145 class CC_EXPORT KeyframedFloatAnimationCurve : public FloatAnimationCurve { | 146 class CC_EXPORT KeyframedFloatAnimationCurve : public FloatAnimationCurve { |
| 146 public: | 147 public: |
| 147 // It is required that the keyframes be sorted by time. | 148 // It is required that the keyframes be sorted by time. |
| 148 static scoped_ptr<KeyframedFloatAnimationCurve> Create(); | 149 static scoped_ptr<KeyframedFloatAnimationCurve> Create(); |
| 149 | 150 |
| 150 ~KeyframedFloatAnimationCurve() override; | 151 ~KeyframedFloatAnimationCurve() override; |
| 151 | 152 |
| 152 void AddKeyframe(scoped_ptr<FloatKeyframe> keyframe); | 153 void AddKeyframe(scoped_ptr<FloatKeyframe> keyframe); |
| 153 void SetTimingFunction(scoped_ptr<TimingFunction> timing_function) { | 154 void SetTimingFunction(scoped_ptr<TimingFunction> timing_function) { |
| 154 timing_function_ = timing_function.Pass(); | 155 timing_function_ = timing_function.Pass(); |
| 155 } | 156 } |
| 156 | 157 |
| 157 // AnimationCurve implementation | 158 // AnimationCurve implementation |
| 158 base::TimeDelta Duration() const override; | 159 base::TimeDelta Duration() const override; |
| 159 scoped_ptr<AnimationCurve> Clone() const override; | 160 scoped_ptr<AnimationCurve> Clone() const override; |
| 160 | 161 |
| 161 // FloatAnimationCurve implementation | 162 // FloatAnimationCurve implementation |
| 162 float GetValue(base::TimeDelta t) const override; | 163 float GetValue(base::TimeDelta t) const override; |
| 163 | 164 |
| 164 private: | 165 private: |
| 165 KeyframedFloatAnimationCurve(); | 166 KeyframedFloatAnimationCurve(); |
| 166 | 167 |
| 167 // 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 |
| 168 // same time. | 169 // same time. |
| 169 ScopedPtrVector<FloatKeyframe> keyframes_; | 170 std::vector<scoped_ptr<FloatKeyframe>> keyframes_; |
| 170 scoped_ptr<TimingFunction> timing_function_; | 171 scoped_ptr<TimingFunction> timing_function_; |
| 171 | 172 |
| 172 DISALLOW_COPY_AND_ASSIGN(KeyframedFloatAnimationCurve); | 173 DISALLOW_COPY_AND_ASSIGN(KeyframedFloatAnimationCurve); |
| 173 }; | 174 }; |
| 174 | 175 |
| 175 class CC_EXPORT KeyframedTransformAnimationCurve | 176 class CC_EXPORT KeyframedTransformAnimationCurve |
| 176 : public TransformAnimationCurve { | 177 : public TransformAnimationCurve { |
| 177 public: | 178 public: |
| 178 // It is required that the keyframes be sorted by time. | 179 // It is required that the keyframes be sorted by time. |
| 179 static scoped_ptr<KeyframedTransformAnimationCurve> Create(); | 180 static scoped_ptr<KeyframedTransformAnimationCurve> Create(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 199 bool AnimationStartScale(bool forward_direction, | 200 bool AnimationStartScale(bool forward_direction, |
| 200 float* start_scale) const override; | 201 float* start_scale) const override; |
| 201 bool MaximumTargetScale(bool forward_direction, | 202 bool MaximumTargetScale(bool forward_direction, |
| 202 float* max_scale) const override; | 203 float* max_scale) const override; |
| 203 | 204 |
| 204 private: | 205 private: |
| 205 KeyframedTransformAnimationCurve(); | 206 KeyframedTransformAnimationCurve(); |
| 206 | 207 |
| 207 // Always sorted in order of increasing time. No two keyframes have the | 208 // Always sorted in order of increasing time. No two keyframes have the |
| 208 // same time. | 209 // same time. |
| 209 ScopedPtrVector<TransformKeyframe> keyframes_; | 210 std::vector<scoped_ptr<TransformKeyframe>> keyframes_; |
| 210 scoped_ptr<TimingFunction> timing_function_; | 211 scoped_ptr<TimingFunction> timing_function_; |
| 211 | 212 |
| 212 DISALLOW_COPY_AND_ASSIGN(KeyframedTransformAnimationCurve); | 213 DISALLOW_COPY_AND_ASSIGN(KeyframedTransformAnimationCurve); |
| 213 }; | 214 }; |
| 214 | 215 |
| 215 class CC_EXPORT KeyframedFilterAnimationCurve | 216 class CC_EXPORT KeyframedFilterAnimationCurve |
| 216 : public FilterAnimationCurve { | 217 : public FilterAnimationCurve { |
| 217 public: | 218 public: |
| 218 // It is required that the keyframes be sorted by time. | 219 // It is required that the keyframes be sorted by time. |
| 219 static scoped_ptr<KeyframedFilterAnimationCurve> Create(); | 220 static scoped_ptr<KeyframedFilterAnimationCurve> Create(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 231 | 232 |
| 232 // FilterAnimationCurve implementation | 233 // FilterAnimationCurve implementation |
| 233 FilterOperations GetValue(base::TimeDelta t) const override; | 234 FilterOperations GetValue(base::TimeDelta t) const override; |
| 234 bool HasFilterThatMovesPixels() const override; | 235 bool HasFilterThatMovesPixels() const override; |
| 235 | 236 |
| 236 private: | 237 private: |
| 237 KeyframedFilterAnimationCurve(); | 238 KeyframedFilterAnimationCurve(); |
| 238 | 239 |
| 239 // Always sorted in order of increasing time. No two keyframes have the | 240 // Always sorted in order of increasing time. No two keyframes have the |
| 240 // same time. | 241 // same time. |
| 241 ScopedPtrVector<FilterKeyframe> keyframes_; | 242 std::vector<scoped_ptr<FilterKeyframe>> keyframes_; |
| 242 scoped_ptr<TimingFunction> timing_function_; | 243 scoped_ptr<TimingFunction> timing_function_; |
| 243 | 244 |
| 244 DISALLOW_COPY_AND_ASSIGN(KeyframedFilterAnimationCurve); | 245 DISALLOW_COPY_AND_ASSIGN(KeyframedFilterAnimationCurve); |
| 245 }; | 246 }; |
| 246 | 247 |
| 247 } // namespace cc | 248 } // namespace cc |
| 248 | 249 |
| 249 #endif // CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_ | 250 #endif // CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_ |
| OLD | NEW |