OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/compositor/layer_animation_element.h" | 5 #include "ui/compositor/layer_animation_element.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "cc/animation.h" | 8 #include "cc/animation.h" |
9 #include "cc/animation_id_provider.h" | 9 #include "cc/animation_id_provider.h" |
10 #include "ui/base/animation/tween.h" | 10 #include "ui/base/animation/tween.h" |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
548 | 548 |
549 if (effective_start_time_ == base::TimeTicks()) { | 549 if (effective_start_time_ == base::TimeTicks()) { |
550 // This hasn't actually started yet. | 550 // This hasn't actually started yet. |
551 need_draw = false; | 551 need_draw = false; |
552 last_progressed_fraction_ = 0.0; | 552 last_progressed_fraction_ = 0.0; |
553 return need_draw; | 553 return need_draw; |
554 } | 554 } |
555 | 555 |
556 base::TimeDelta elapsed = now - effective_start_time_; | 556 base::TimeDelta elapsed = now - effective_start_time_; |
557 if ((duration_ > base::TimeDelta()) && (elapsed < duration_)) | 557 if ((duration_ > base::TimeDelta()) && (elapsed < duration_)) |
558 t = elapsed.InMillisecondsF() / duration_.InMillisecondsF(); | 558 t = std::max(0.0, elapsed.InMillisecondsF() / duration_.InMillisecondsF()); |
James Cook
2013/03/05 20:30:38
Maybe comment why this is needed?
Harry McCleave
2013/03/06 01:59:49
Removed this, it was a place holder for the proper
| |
559 need_draw = OnProgress(Tween::CalculateValue(tween_type_, t), delegate); | 559 need_draw = OnProgress(Tween::CalculateValue(tween_type_, t), delegate); |
560 first_frame_ = t == 1.0; | 560 first_frame_ = t == 1.0; |
561 last_progressed_fraction_ = t; | 561 last_progressed_fraction_ = t; |
562 return need_draw; | 562 return need_draw; |
563 } | 563 } |
564 | 564 |
565 bool LayerAnimationElement::IsFinished(base::TimeTicks time, | 565 bool LayerAnimationElement::IsFinished(base::TimeTicks time, |
566 base::TimeDelta* total_duration) { | 566 base::TimeDelta* total_duration) { |
567 // If an effective start has been requested but the effective start time | 567 // If an effective start has been requested but the effective start time |
568 // hasn't yet been set, the animation is not finished, regardless of the | 568 // hasn't yet been set, the animation is not finished, regardless of the |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
695 } | 695 } |
696 | 696 |
697 // static | 697 // static |
698 LayerAnimationElement* LayerAnimationElement::CreateColorElement( | 698 LayerAnimationElement* LayerAnimationElement::CreateColorElement( |
699 SkColor color, | 699 SkColor color, |
700 base::TimeDelta duration) { | 700 base::TimeDelta duration) { |
701 return new ColorTransition(color, duration); | 701 return new ColorTransition(color, duration); |
702 } | 702 } |
703 | 703 |
704 } // namespace ui | 704 } // namespace ui |
OLD | NEW |