Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: cc/animation/keyframed_animation_curve.cc

Issue 693883004: Make cc::animation::TrimTimeToCurrentIteration,cc::AnimationCurve::Duration use TimeTicks/TimeDelta (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/animation/keyframed_animation_curve.h ('k') | cc/animation/layer_animation_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <algorithm> 5 #include <algorithm>
6 6
7 #include "cc/animation/keyframed_animation_curve.h" 7 #include "cc/animation/keyframed_animation_curve.h"
8 #include "ui/gfx/animation/tween.h" 8 #include "ui/gfx/animation/tween.h"
9 #include "ui/gfx/geometry/box_f.h" 9 #include "ui/gfx/geometry/box_f.h"
10 10
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 198
199 KeyframedColorAnimationCurve::KeyframedColorAnimationCurve() {} 199 KeyframedColorAnimationCurve::KeyframedColorAnimationCurve() {}
200 200
201 KeyframedColorAnimationCurve::~KeyframedColorAnimationCurve() {} 201 KeyframedColorAnimationCurve::~KeyframedColorAnimationCurve() {}
202 202
203 void KeyframedColorAnimationCurve::AddKeyframe( 203 void KeyframedColorAnimationCurve::AddKeyframe(
204 scoped_ptr<ColorKeyframe> keyframe) { 204 scoped_ptr<ColorKeyframe> keyframe) {
205 InsertKeyframe(keyframe.Pass(), &keyframes_); 205 InsertKeyframe(keyframe.Pass(), &keyframes_);
206 } 206 }
207 207
208 double KeyframedColorAnimationCurve::Duration() const { 208 base::TimeDelta KeyframedColorAnimationCurve::Duration() const {
209 return keyframes_.back()->Time() - keyframes_.front()->Time(); 209 return base::TimeDelta::FromSecondsD(keyframes_.back()->Time() -
210 keyframes_.front()->Time());
210 } 211 }
211 212
212 scoped_ptr<AnimationCurve> KeyframedColorAnimationCurve::Clone() const { 213 scoped_ptr<AnimationCurve> KeyframedColorAnimationCurve::Clone() const {
213 scoped_ptr<KeyframedColorAnimationCurve> to_return = 214 scoped_ptr<KeyframedColorAnimationCurve> to_return =
214 KeyframedColorAnimationCurve::Create(); 215 KeyframedColorAnimationCurve::Create();
215 for (size_t i = 0; i < keyframes_.size(); ++i) 216 for (size_t i = 0; i < keyframes_.size(); ++i)
216 to_return->AddKeyframe(keyframes_[i]->Clone()); 217 to_return->AddKeyframe(keyframes_[i]->Clone());
217 218
218 if (timing_function_) 219 if (timing_function_)
219 to_return->SetTimingFunction(timing_function_->Clone()); 220 to_return->SetTimingFunction(timing_function_->Clone());
(...skipping 25 matching lines...) Expand all
245 246
246 KeyframedFloatAnimationCurve::KeyframedFloatAnimationCurve() {} 247 KeyframedFloatAnimationCurve::KeyframedFloatAnimationCurve() {}
247 248
248 KeyframedFloatAnimationCurve::~KeyframedFloatAnimationCurve() {} 249 KeyframedFloatAnimationCurve::~KeyframedFloatAnimationCurve() {}
249 250
250 void KeyframedFloatAnimationCurve::AddKeyframe( 251 void KeyframedFloatAnimationCurve::AddKeyframe(
251 scoped_ptr<FloatKeyframe> keyframe) { 252 scoped_ptr<FloatKeyframe> keyframe) {
252 InsertKeyframe(keyframe.Pass(), &keyframes_); 253 InsertKeyframe(keyframe.Pass(), &keyframes_);
253 } 254 }
254 255
255 double KeyframedFloatAnimationCurve::Duration() const { 256 base::TimeDelta KeyframedFloatAnimationCurve::Duration() const {
256 return keyframes_.back()->Time() - keyframes_.front()->Time(); 257 return base::TimeDelta::FromSecondsD(keyframes_.back()->Time() -
258 keyframes_.front()->Time());
257 } 259 }
258 260
259 scoped_ptr<AnimationCurve> KeyframedFloatAnimationCurve::Clone() const { 261 scoped_ptr<AnimationCurve> KeyframedFloatAnimationCurve::Clone() const {
260 scoped_ptr<KeyframedFloatAnimationCurve> to_return = 262 scoped_ptr<KeyframedFloatAnimationCurve> to_return =
261 KeyframedFloatAnimationCurve::Create(); 263 KeyframedFloatAnimationCurve::Create();
262 for (size_t i = 0; i < keyframes_.size(); ++i) 264 for (size_t i = 0; i < keyframes_.size(); ++i)
263 to_return->AddKeyframe(keyframes_[i]->Clone()); 265 to_return->AddKeyframe(keyframes_[i]->Clone());
264 266
265 if (timing_function_) 267 if (timing_function_)
266 to_return->SetTimingFunction(timing_function_->Clone()); 268 to_return->SetTimingFunction(timing_function_->Clone());
(...skipping 23 matching lines...) Expand all
290 292
291 KeyframedTransformAnimationCurve::KeyframedTransformAnimationCurve() {} 293 KeyframedTransformAnimationCurve::KeyframedTransformAnimationCurve() {}
292 294
293 KeyframedTransformAnimationCurve::~KeyframedTransformAnimationCurve() {} 295 KeyframedTransformAnimationCurve::~KeyframedTransformAnimationCurve() {}
294 296
295 void KeyframedTransformAnimationCurve::AddKeyframe( 297 void KeyframedTransformAnimationCurve::AddKeyframe(
296 scoped_ptr<TransformKeyframe> keyframe) { 298 scoped_ptr<TransformKeyframe> keyframe) {
297 InsertKeyframe(keyframe.Pass(), &keyframes_); 299 InsertKeyframe(keyframe.Pass(), &keyframes_);
298 } 300 }
299 301
300 double KeyframedTransformAnimationCurve::Duration() const { 302 base::TimeDelta KeyframedTransformAnimationCurve::Duration() const {
301 return keyframes_.back()->Time() - keyframes_.front()->Time(); 303 return base::TimeDelta::FromSecondsD(keyframes_.back()->Time() -
304 keyframes_.front()->Time());
302 } 305 }
303 306
304 scoped_ptr<AnimationCurve> KeyframedTransformAnimationCurve::Clone() const { 307 scoped_ptr<AnimationCurve> KeyframedTransformAnimationCurve::Clone() const {
305 scoped_ptr<KeyframedTransformAnimationCurve> to_return = 308 scoped_ptr<KeyframedTransformAnimationCurve> to_return =
306 KeyframedTransformAnimationCurve::Create(); 309 KeyframedTransformAnimationCurve::Create();
307 for (size_t i = 0; i < keyframes_.size(); ++i) 310 for (size_t i = 0; i < keyframes_.size(); ++i)
308 to_return->AddKeyframe(keyframes_[i]->Clone()); 311 to_return->AddKeyframe(keyframes_[i]->Clone());
309 312
310 if (timing_function_) 313 if (timing_function_)
311 to_return->SetTimingFunction(timing_function_->Clone()); 314 to_return->SetTimingFunction(timing_function_->Clone());
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 404
402 KeyframedFilterAnimationCurve::KeyframedFilterAnimationCurve() {} 405 KeyframedFilterAnimationCurve::KeyframedFilterAnimationCurve() {}
403 406
404 KeyframedFilterAnimationCurve::~KeyframedFilterAnimationCurve() {} 407 KeyframedFilterAnimationCurve::~KeyframedFilterAnimationCurve() {}
405 408
406 void KeyframedFilterAnimationCurve::AddKeyframe( 409 void KeyframedFilterAnimationCurve::AddKeyframe(
407 scoped_ptr<FilterKeyframe> keyframe) { 410 scoped_ptr<FilterKeyframe> keyframe) {
408 InsertKeyframe(keyframe.Pass(), &keyframes_); 411 InsertKeyframe(keyframe.Pass(), &keyframes_);
409 } 412 }
410 413
411 double KeyframedFilterAnimationCurve::Duration() const { 414 base::TimeDelta KeyframedFilterAnimationCurve::Duration() const {
412 return keyframes_.back()->Time() - keyframes_.front()->Time(); 415 return base::TimeDelta::FromSecondsD(keyframes_.back()->Time() -
416 keyframes_.front()->Time());
413 } 417 }
414 418
415 scoped_ptr<AnimationCurve> KeyframedFilterAnimationCurve::Clone() const { 419 scoped_ptr<AnimationCurve> KeyframedFilterAnimationCurve::Clone() const {
416 scoped_ptr<KeyframedFilterAnimationCurve> to_return = 420 scoped_ptr<KeyframedFilterAnimationCurve> to_return =
417 KeyframedFilterAnimationCurve::Create(); 421 KeyframedFilterAnimationCurve::Create();
418 for (size_t i = 0; i < keyframes_.size(); ++i) 422 for (size_t i = 0; i < keyframes_.size(); ++i)
419 to_return->AddKeyframe(keyframes_[i]->Clone()); 423 to_return->AddKeyframe(keyframes_[i]->Clone());
420 424
421 if (timing_function_) 425 if (timing_function_)
422 to_return->SetTimingFunction(timing_function_->Clone()); 426 to_return->SetTimingFunction(timing_function_->Clone());
(...skipping 18 matching lines...) Expand all
441 bool KeyframedFilterAnimationCurve::HasFilterThatMovesPixels() const { 445 bool KeyframedFilterAnimationCurve::HasFilterThatMovesPixels() const {
442 for (size_t i = 0; i < keyframes_.size(); ++i) { 446 for (size_t i = 0; i < keyframes_.size(); ++i) {
443 if (keyframes_[i]->Value().HasFilterThatMovesPixels()) { 447 if (keyframes_[i]->Value().HasFilterThatMovesPixels()) {
444 return true; 448 return true;
445 } 449 }
446 } 450 }
447 return false; 451 return false;
448 } 452 }
449 453
450 } // namespace cc 454 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/keyframed_animation_curve.h ('k') | cc/animation/layer_animation_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698