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 #include "cc/animation/layer_animation_controller.h" | 5 #include "cc/animation/layer_animation_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "cc/animation/animation.h" | 9 #include "cc/animation/animation.h" |
10 #include "cc/animation/animation_delegate.h" | 10 #include "cc/animation/animation_delegate.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 base::TimeTicks monotonic_time, | 137 base::TimeTicks monotonic_time, |
138 AnimationEventsVector* events) { | 138 AnimationEventsVector* events) { |
139 if (!events) | 139 if (!events) |
140 return; | 140 return; |
141 | 141 |
142 for (size_t i = 0; i < animations_.size(); ++i) { | 142 for (size_t i = 0; i < animations_.size(); ++i) { |
143 Animation* animation = animations_[i]; | 143 Animation* animation = animations_[i]; |
144 if (!animation->is_impl_only()) | 144 if (!animation->is_impl_only()) |
145 continue; | 145 continue; |
146 | 146 |
| 147 if (animation->NoEffectBeforeAnimation(monotonic_time)) |
| 148 continue; |
| 149 |
147 double trimmed = animation->TrimTimeToCurrentIteration(monotonic_time); | 150 double trimmed = animation->TrimTimeToCurrentIteration(monotonic_time); |
148 switch (animation->target_property()) { | 151 switch (animation->target_property()) { |
149 case Animation::Opacity: { | 152 case Animation::Opacity: { |
150 AnimationEvent event(AnimationEvent::PropertyUpdate, | 153 AnimationEvent event(AnimationEvent::PropertyUpdate, |
151 id_, | 154 id_, |
152 animation->group(), | 155 animation->group(), |
153 Animation::Opacity, | 156 Animation::Opacity, |
154 monotonic_time); | 157 monotonic_time); |
155 const FloatAnimationCurve* float_animation_curve = | 158 const FloatAnimationCurve* float_animation_curve = |
156 animation->curve()->ToFloatAnimationCurve(); | 159 animation->curve()->ToFloatAnimationCurve(); |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 animations_.end(), | 831 animations_.end(), |
829 IsWaitingForDeletion), | 832 IsWaitingForDeletion), |
830 animations_.end()); | 833 animations_.end()); |
831 } | 834 } |
832 | 835 |
833 void LayerAnimationController::TickAnimations(base::TimeTicks monotonic_time) { | 836 void LayerAnimationController::TickAnimations(base::TimeTicks monotonic_time) { |
834 for (size_t i = 0; i < animations_.size(); ++i) { | 837 for (size_t i = 0; i < animations_.size(); ++i) { |
835 if (animations_[i]->run_state() == Animation::Starting || | 838 if (animations_[i]->run_state() == Animation::Starting || |
836 animations_[i]->run_state() == Animation::Running || | 839 animations_[i]->run_state() == Animation::Running || |
837 animations_[i]->run_state() == Animation::Paused) { | 840 animations_[i]->run_state() == Animation::Paused) { |
| 841 if (animations_[i]->NoEffectBeforeAnimation(monotonic_time)) |
| 842 continue; |
| 843 |
838 double trimmed = | 844 double trimmed = |
839 animations_[i]->TrimTimeToCurrentIteration(monotonic_time); | 845 animations_[i]->TrimTimeToCurrentIteration(monotonic_time); |
840 | 846 |
841 switch (animations_[i]->target_property()) { | 847 switch (animations_[i]->target_property()) { |
842 case Animation::Transform: { | 848 case Animation::Transform: { |
843 const TransformAnimationCurve* transform_animation_curve = | 849 const TransformAnimationCurve* transform_animation_curve = |
844 animations_[i]->curve()->ToTransformAnimationCurve(); | 850 animations_[i]->curve()->ToTransformAnimationCurve(); |
845 const gfx::Transform transform = | 851 const gfx::Transform transform = |
846 transform_animation_curve->GetValue(trimmed); | 852 transform_animation_curve->GetValue(trimmed); |
847 NotifyObserversTransformAnimated( | 853 NotifyObserversTransformAnimated( |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 value_observers_); | 1014 value_observers_); |
1009 LayerAnimationValueObserver* obs; | 1015 LayerAnimationValueObserver* obs; |
1010 while ((obs = it.GetNext()) != NULL) | 1016 while ((obs = it.GetNext()) != NULL) |
1011 if (obs->IsActive()) | 1017 if (obs->IsActive()) |
1012 return true; | 1018 return true; |
1013 } | 1019 } |
1014 return false; | 1020 return false; |
1015 } | 1021 } |
1016 | 1022 |
1017 } // namespace cc | 1023 } // namespace cc |
OLD | NEW |