| 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 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "cc/animation/animation.h" | 10 #include "cc/animation/animation.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 scoped_refptr<LayerAnimationController> LayerAnimationController::Create( | 39 scoped_refptr<LayerAnimationController> LayerAnimationController::Create( |
| 40 int id) { | 40 int id) { |
| 41 return make_scoped_refptr(new LayerAnimationController(id)); | 41 return make_scoped_refptr(new LayerAnimationController(id)); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void LayerAnimationController::PauseAnimation(int animation_id, | 44 void LayerAnimationController::PauseAnimation(int animation_id, |
| 45 base::TimeDelta time_offset) { | 45 base::TimeDelta time_offset) { |
| 46 for (size_t i = 0; i < animations_.size(); ++i) { | 46 for (size_t i = 0; i < animations_.size(); ++i) { |
| 47 if (animations_[i]->id() == animation_id) { | 47 if (animations_[i]->id() == animation_id) { |
| 48 animations_[i]->SetRunState(Animation::PAUSED, | 48 animations_[i]->SetRunState(Animation::PAUSED, |
| 49 time_offset + animations_[i]->start_time()); | 49 time_offset + animations_[i]->start_time() + |
| 50 animations_[i]->time_offset()); |
| 50 } | 51 } |
| 51 } | 52 } |
| 52 } | 53 } |
| 53 | 54 |
| 54 struct HasAnimationId { | 55 struct HasAnimationId { |
| 55 explicit HasAnimationId(int id) : id_(id) {} | 56 explicit HasAnimationId(int id) : id_(id) {} |
| 56 bool operator()(Animation* animation) const { | 57 bool operator()(Animation* animation) const { |
| 57 return animation->id() == id_; | 58 return animation->id() == id_; |
| 58 } | 59 } |
| 59 | 60 |
| (...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1068 &value_observers_); | 1069 &value_observers_); |
| 1069 LayerAnimationValueObserver* obs; | 1070 LayerAnimationValueObserver* obs; |
| 1070 while ((obs = it.GetNext()) != nullptr) | 1071 while ((obs = it.GetNext()) != nullptr) |
| 1071 if (obs->IsActive()) | 1072 if (obs->IsActive()) |
| 1072 return true; | 1073 return true; |
| 1073 } | 1074 } |
| 1074 return false; | 1075 return false; |
| 1075 } | 1076 } |
| 1076 | 1077 |
| 1077 } // namespace cc | 1078 } // namespace cc |
| OLD | NEW |