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.h" | 8 #include "cc/animation.h" |
9 #include "cc/animation_id_provider.h" | 9 #include "cc/animation_id_provider.h" |
10 #include "ui/base/animation/tween.h" | 10 #include "ui/base/animation/tween.h" |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 virtual ~ThreadedOpacityTransition() {} | 437 virtual ~ThreadedOpacityTransition() {} |
438 | 438 |
439 protected: | 439 protected: |
440 virtual void OnStart(LayerAnimationDelegate* delegate) OVERRIDE { | 440 virtual void OnStart(LayerAnimationDelegate* delegate) OVERRIDE { |
441 start_ = delegate->GetOpacityForAnimation(); | 441 start_ = delegate->GetOpacityForAnimation(); |
442 } | 442 } |
443 | 443 |
444 virtual void OnAbort(LayerAnimationDelegate* delegate) OVERRIDE { | 444 virtual void OnAbort(LayerAnimationDelegate* delegate) OVERRIDE { |
445 if (delegate && Started()) { | 445 if (delegate && Started()) { |
446 ThreadedLayerAnimationElement::OnAbort(delegate); | 446 ThreadedLayerAnimationElement::OnAbort(delegate); |
447 delegate->SetOpacityFromAnimation( | 447 delegate->SetOpacityFromAnimation(Tween::ValueBetween( |
448 Tween::ValueBetween(last_progressed_fraction(), start_, target_)); | 448 Tween::CalculateValue(tween_type(), last_progressed_fraction()), |
| 449 start_, |
| 450 target_)); |
449 } | 451 } |
450 } | 452 } |
451 | 453 |
452 virtual void OnEnd(LayerAnimationDelegate* delegate) OVERRIDE { | 454 virtual void OnEnd(LayerAnimationDelegate* delegate) OVERRIDE { |
453 delegate->SetOpacityFromAnimation(target_); | 455 delegate->SetOpacityFromAnimation(target_); |
454 } | 456 } |
455 | 457 |
456 virtual scoped_ptr<cc::Animation> CreateCCAnimation() OVERRIDE { | 458 virtual scoped_ptr<cc::Animation> CreateCCAnimation() OVERRIDE { |
457 scoped_ptr<cc::AnimationCurve> animation_curve( | 459 scoped_ptr<cc::AnimationCurve> animation_curve( |
458 new FloatAnimationCurveAdapter(tween_type(), | 460 new FloatAnimationCurveAdapter(tween_type(), |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 } | 695 } |
694 | 696 |
695 // static | 697 // static |
696 LayerAnimationElement* LayerAnimationElement::CreateColorElement( | 698 LayerAnimationElement* LayerAnimationElement::CreateColorElement( |
697 SkColor color, | 699 SkColor color, |
698 base::TimeDelta duration) { | 700 base::TimeDelta duration) { |
699 return new ColorTransition(color, duration); | 701 return new ColorTransition(color, duration); |
700 } | 702 } |
701 | 703 |
702 } // namespace ui | 704 } // namespace ui |
OLD | NEW |