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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 ThreadedTransformTransition(const gfx::Transform& target, | 502 ThreadedTransformTransition(const gfx::Transform& target, |
503 base::TimeDelta duration) | 503 base::TimeDelta duration) |
504 : ThreadedLayerAnimationElement(GetProperties(), duration), | 504 : ThreadedLayerAnimationElement(GetProperties(), duration), |
505 target_(target) { | 505 target_(target) { |
506 } | 506 } |
507 virtual ~ThreadedTransformTransition() {} | 507 virtual ~ThreadedTransformTransition() {} |
508 | 508 |
509 protected: | 509 protected: |
510 virtual void OnStart(LayerAnimationDelegate* delegate) OVERRIDE { | 510 virtual void OnStart(LayerAnimationDelegate* delegate) OVERRIDE { |
511 start_ = delegate->GetTransformForAnimation(); | 511 start_ = delegate->GetTransformForAnimation(); |
512 gfx::Rect bounds = delegate->GetBoundsForAnimation(); | |
513 float device_scale_factor = delegate->GetDeviceScaleFactor(); | 512 float device_scale_factor = delegate->GetDeviceScaleFactor(); |
514 cc_start_ = Layer::ConvertTransformToCCTransform(start_, | 513 cc_start_ = Layer::ConvertTransformToCCTransform(start_, |
515 bounds, | |
516 device_scale_factor); | 514 device_scale_factor); |
517 cc_target_ = Layer::ConvertTransformToCCTransform(target_, | 515 cc_target_ = Layer::ConvertTransformToCCTransform(target_, |
518 bounds, | |
519 device_scale_factor); | 516 device_scale_factor); |
520 } | 517 } |
521 | 518 |
522 virtual void OnAbort(LayerAnimationDelegate* delegate) OVERRIDE { | 519 virtual void OnAbort(LayerAnimationDelegate* delegate) OVERRIDE { |
523 if (delegate && animation_id()) { | 520 if (delegate && animation_id()) { |
524 ThreadedLayerAnimationElement::OnAbort(delegate); | 521 ThreadedLayerAnimationElement::OnAbort(delegate); |
525 delegate->SetTransformFromAnimation(Tween::ValueBetween( | 522 delegate->SetTransformFromAnimation(Tween::ValueBetween( |
526 Tween::CalculateValue(tween_type(), last_progressed_fraction()), | 523 Tween::CalculateValue(tween_type(), last_progressed_fraction()), |
527 start_, | 524 start_, |
528 target_)); | 525 target_)); |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 } | 779 } |
783 | 780 |
784 // static | 781 // static |
785 LayerAnimationElement* LayerAnimationElement::CreateColorElement( | 782 LayerAnimationElement* LayerAnimationElement::CreateColorElement( |
786 SkColor color, | 783 SkColor color, |
787 base::TimeDelta duration) { | 784 base::TimeDelta duration) { |
788 return new ColorTransition(color, duration); | 785 return new ColorTransition(color, duration); |
789 } | 786 } |
790 | 787 |
791 } // namespace ui | 788 } // namespace ui |
OLD | NEW |