| 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> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 class CC_EXPORT KeyframedFloatAnimationCurve : public FloatAnimationCurve { | 148 class CC_EXPORT KeyframedFloatAnimationCurve : public FloatAnimationCurve { |
| 149 public: | 149 public: |
| 150 // It is required that the keyframes be sorted by time. | 150 // It is required that the keyframes be sorted by time. |
| 151 static std::unique_ptr<KeyframedFloatAnimationCurve> Create(); | 151 static std::unique_ptr<KeyframedFloatAnimationCurve> Create(); |
| 152 | 152 |
| 153 ~KeyframedFloatAnimationCurve() override; | 153 ~KeyframedFloatAnimationCurve() override; |
| 154 | 154 |
| 155 void AddKeyframe(std::unique_ptr<FloatKeyframe> keyframe); | 155 void AddKeyframe(std::unique_ptr<FloatKeyframe> keyframe); |
| 156 |
| 156 void SetTimingFunction(std::unique_ptr<TimingFunction> timing_function) { | 157 void SetTimingFunction(std::unique_ptr<TimingFunction> timing_function) { |
| 157 timing_function_ = std::move(timing_function); | 158 timing_function_ = std::move(timing_function); |
| 158 } | 159 } |
| 160 TimingFunction* timing_function_for_testing() const { |
| 161 return timing_function_.get(); |
| 162 } |
| 159 | 163 |
| 160 // AnimationCurve implementation | 164 // AnimationCurve implementation |
| 161 base::TimeDelta Duration() const override; | 165 base::TimeDelta Duration() const override; |
| 162 std::unique_ptr<AnimationCurve> Clone() const override; | 166 std::unique_ptr<AnimationCurve> Clone() const override; |
| 163 | 167 |
| 164 // FloatAnimationCurve implementation | 168 // FloatAnimationCurve implementation |
| 165 float GetValue(base::TimeDelta t) const override; | 169 float GetValue(base::TimeDelta t) const override; |
| 166 | 170 |
| 171 using Keyframes = std::vector<std::unique_ptr<FloatKeyframe>>; |
| 172 const Keyframes& keyframes_for_testing() const { return keyframes_; } |
| 173 |
| 167 private: | 174 private: |
| 168 KeyframedFloatAnimationCurve(); | 175 KeyframedFloatAnimationCurve(); |
| 169 | 176 |
| 170 // Always sorted in order of increasing time. No two keyframes have the | 177 // Always sorted in order of increasing time. No two keyframes have the |
| 171 // same time. | 178 // same time. |
| 172 std::vector<std::unique_ptr<FloatKeyframe>> keyframes_; | 179 Keyframes keyframes_; |
| 173 std::unique_ptr<TimingFunction> timing_function_; | 180 std::unique_ptr<TimingFunction> timing_function_; |
| 174 | 181 |
| 175 DISALLOW_COPY_AND_ASSIGN(KeyframedFloatAnimationCurve); | 182 DISALLOW_COPY_AND_ASSIGN(KeyframedFloatAnimationCurve); |
| 176 }; | 183 }; |
| 177 | 184 |
| 178 class CC_EXPORT KeyframedTransformAnimationCurve | 185 class CC_EXPORT KeyframedTransformAnimationCurve |
| 179 : public TransformAnimationCurve { | 186 : public TransformAnimationCurve { |
| 180 public: | 187 public: |
| 181 // It is required that the keyframes be sorted by time. | 188 // It is required that the keyframes be sorted by time. |
| 182 static std::unique_ptr<KeyframedTransformAnimationCurve> Create(); | 189 static std::unique_ptr<KeyframedTransformAnimationCurve> Create(); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 // same time. | 250 // same time. |
| 244 std::vector<std::unique_ptr<FilterKeyframe>> keyframes_; | 251 std::vector<std::unique_ptr<FilterKeyframe>> keyframes_; |
| 245 std::unique_ptr<TimingFunction> timing_function_; | 252 std::unique_ptr<TimingFunction> timing_function_; |
| 246 | 253 |
| 247 DISALLOW_COPY_AND_ASSIGN(KeyframedFilterAnimationCurve); | 254 DISALLOW_COPY_AND_ASSIGN(KeyframedFilterAnimationCurve); |
| 248 }; | 255 }; |
| 249 | 256 |
| 250 } // namespace cc | 257 } // namespace cc |
| 251 | 258 |
| 252 #endif // CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_ | 259 #endif // CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_ |
| OLD | NEW |