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/animation.h" | 8 #include "cc/animation/animation.h" |
9 #include "cc/animation/animation_id_provider.h" | 9 #include "cc/animation/animation_id_provider.h" |
10 #include "ui/base/animation/tween.h" | 10 #include "ui/base/animation/tween.h" |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 virtual void OnStart(LayerAnimationDelegate* delegate) OVERRIDE { | 510 virtual void OnStart(LayerAnimationDelegate* delegate) OVERRIDE { |
511 start_ = delegate->GetTransformForAnimation(); | 511 start_ = delegate->GetTransformForAnimation(); |
512 float device_scale_factor = delegate->GetDeviceScaleFactor(); | 512 float device_scale_factor = delegate->GetDeviceScaleFactor(); |
513 cc_start_ = Layer::ConvertTransformToCCTransform(start_, | 513 cc_start_ = Layer::ConvertTransformToCCTransform(start_, |
514 device_scale_factor); | 514 device_scale_factor); |
515 cc_target_ = Layer::ConvertTransformToCCTransform(target_, | 515 cc_target_ = Layer::ConvertTransformToCCTransform(target_, |
516 device_scale_factor); | 516 device_scale_factor); |
517 } | 517 } |
518 | 518 |
519 virtual void OnAbort(LayerAnimationDelegate* delegate) OVERRIDE { | 519 virtual void OnAbort(LayerAnimationDelegate* delegate) OVERRIDE { |
520 if (delegate && animation_id()) { | 520 if (delegate && Started()) { |
521 ThreadedLayerAnimationElement::OnAbort(delegate); | 521 ThreadedLayerAnimationElement::OnAbort(delegate); |
522 delegate->SetTransformFromAnimation(Tween::ValueBetween( | 522 delegate->SetTransformFromAnimation(Tween::ValueBetween( |
523 Tween::CalculateValue(tween_type(), last_progressed_fraction()), | 523 Tween::CalculateValue(tween_type(), last_progressed_fraction()), |
524 start_, | 524 start_, |
525 target_)); | 525 target_)); |
526 } | 526 } |
527 } | 527 } |
528 | 528 |
529 virtual void OnEnd(LayerAnimationDelegate* delegate) OVERRIDE { | 529 virtual void OnEnd(LayerAnimationDelegate* delegate) OVERRIDE { |
530 delegate->SetTransformFromAnimation(target_); | 530 delegate->SetTransformFromAnimation(target_); |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 } | 779 } |
780 | 780 |
781 // static | 781 // static |
782 LayerAnimationElement* LayerAnimationElement::CreateColorElement( | 782 LayerAnimationElement* LayerAnimationElement::CreateColorElement( |
783 SkColor color, | 783 SkColor color, |
784 base::TimeDelta duration) { | 784 base::TimeDelta duration) { |
785 return new ColorTransition(color, duration); | 785 return new ColorTransition(color, duration); |
786 } | 786 } |
787 | 787 |
788 } // namespace ui | 788 } // namespace ui |
OLD | NEW |