| 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_animator.h" | 5 #include "ui/compositor/layer_animator.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ui/base/animation/animation_container.h" | 10 #include "ui/base/animation/animation_container.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 // static | 66 // static |
| 67 LayerAnimator* LayerAnimator::CreateDefaultAnimator() { | 67 LayerAnimator* LayerAnimator::CreateDefaultAnimator() { |
| 68 return new LayerAnimator(base::TimeDelta::FromMilliseconds(0)); | 68 return new LayerAnimator(base::TimeDelta::FromMilliseconds(0)); |
| 69 } | 69 } |
| 70 | 70 |
| 71 // static | 71 // static |
| 72 LayerAnimator* LayerAnimator::CreateImplicitAnimator() { | 72 LayerAnimator* LayerAnimator::CreateImplicitAnimator() { |
| 73 return new LayerAnimator(kDefaultTransitionDuration); | 73 return new LayerAnimator(kDefaultTransitionDuration); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void LayerAnimator::SetTransform(const Transform& transform) { | 76 void LayerAnimator::SetTransform(const gfx::Transform& transform) { |
| 77 base::TimeDelta duration = GetTransitionDuration(); | 77 base::TimeDelta duration = GetTransitionDuration(); |
| 78 scoped_ptr<LayerAnimationElement> element( | 78 scoped_ptr<LayerAnimationElement> element( |
| 79 LayerAnimationElement::CreateTransformElement(transform, duration)); | 79 LayerAnimationElement::CreateTransformElement(transform, duration)); |
| 80 element->set_tween_type(tween_type_); | 80 element->set_tween_type(tween_type_); |
| 81 StartAnimation(new LayerAnimationSequence(element.release())); | 81 StartAnimation(new LayerAnimationSequence(element.release())); |
| 82 } | 82 } |
| 83 | 83 |
| 84 Transform LayerAnimator::GetTargetTransform() const { | 84 gfx::Transform LayerAnimator::GetTargetTransform() const { |
| 85 LayerAnimationElement::TargetValue target(delegate()); | 85 LayerAnimationElement::TargetValue target(delegate()); |
| 86 GetTargetValue(&target); | 86 GetTargetValue(&target); |
| 87 return target.transform; | 87 return target.transform; |
| 88 } | 88 } |
| 89 | 89 |
| 90 void LayerAnimator::SetBounds(const gfx::Rect& bounds) { | 90 void LayerAnimator::SetBounds(const gfx::Rect& bounds) { |
| 91 base::TimeDelta duration = GetTransitionDuration(); | 91 base::TimeDelta duration = GetTransitionDuration(); |
| 92 scoped_ptr<LayerAnimationElement> element( | 92 scoped_ptr<LayerAnimationElement> element( |
| 93 LayerAnimationElement::CreateBoundsElement(bounds, duration)); | 93 LayerAnimationElement::CreateBoundsElement(bounds, duration)); |
| 94 element->set_tween_type(tween_type_); | 94 element->set_tween_type(tween_type_); |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 removed->Abort(); | 667 removed->Abort(); |
| 668 } | 668 } |
| 669 // This *should* have cleared the list of running animations. | 669 // This *should* have cleared the list of running animations. |
| 670 DCHECK(running_animations_.empty()); | 670 DCHECK(running_animations_.empty()); |
| 671 running_animations_.clear(); | 671 running_animations_.clear(); |
| 672 animation_queue_.clear(); | 672 animation_queue_.clear(); |
| 673 UpdateAnimationState(); | 673 UpdateAnimationState(); |
| 674 } | 674 } |
| 675 | 675 |
| 676 } // namespace ui | 676 } // namespace ui |
| OLD | NEW |