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/gfx/compositor/layer_animation_sequence.h" | 5 #include "ui/gfx/compositor/layer_animation_sequence.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 | 9 |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 FOR_EACH_OBSERVER(LayerAnimationObserver, | 29 FOR_EACH_OBSERVER(LayerAnimationObserver, |
30 observers_, | 30 observers_, |
31 DetachedFromSequence(this)); | 31 DetachedFromSequence(this)); |
32 } | 32 } |
33 | 33 |
34 void LayerAnimationSequence::Progress(base::TimeDelta elapsed, | 34 void LayerAnimationSequence::Progress(base::TimeDelta elapsed, |
35 LayerAnimationDelegate* delegate) { | 35 LayerAnimationDelegate* delegate) { |
36 if (elements_.empty()) | 36 if (elements_.empty()) |
37 return; | 37 return; |
38 | 38 |
| 39 // We are now animating. |
| 40 is_animating_ = true; |
| 41 |
39 if (is_cyclic_ && duration_ > base::TimeDelta()) { | 42 if (is_cyclic_ && duration_ > base::TimeDelta()) { |
40 // If delta = elapsed - last_start_ is huge, we can skip ahead by complete | 43 // If delta = elapsed - last_start_ is huge, we can skip ahead by complete |
41 // loops to save time. | 44 // loops to save time. |
42 base::TimeDelta delta = elapsed - last_start_; | 45 base::TimeDelta delta = elapsed - last_start_; |
43 int64 k = delta.ToInternalValue() / duration_.ToInternalValue() - 1; | 46 int64 k = delta.ToInternalValue() / duration_.ToInternalValue() - 1; |
44 if (k > 0) { | 47 if (k > 0) { |
45 last_start_ += base::TimeDelta::FromInternalValue( | 48 last_start_ += base::TimeDelta::FromInternalValue( |
46 k * duration_.ToInternalValue()); | 49 k * duration_.ToInternalValue()); |
47 } | 50 } |
48 } | 51 } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 OnLayerAnimationEnded(this)); | 153 OnLayerAnimationEnded(this)); |
151 } | 154 } |
152 | 155 |
153 void LayerAnimationSequence::NotifyAborted() { | 156 void LayerAnimationSequence::NotifyAborted() { |
154 FOR_EACH_OBSERVER(LayerAnimationObserver, | 157 FOR_EACH_OBSERVER(LayerAnimationObserver, |
155 observers_, | 158 observers_, |
156 OnLayerAnimationAborted(this)); | 159 OnLayerAnimationAborted(this)); |
157 } | 160 } |
158 | 161 |
159 } // namespace ui | 162 } // namespace ui |
OLD | NEW |