| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 void OnEnd(LayerAnimationDelegate* delegate) override { | 416 void OnEnd(LayerAnimationDelegate* delegate) override { |
| 417 delegate->SetOpacityFromAnimation(target_); | 417 delegate->SetOpacityFromAnimation(target_); |
| 418 } | 418 } |
| 419 | 419 |
| 420 scoped_ptr<cc::Animation> CreateCCAnimation() override { | 420 scoped_ptr<cc::Animation> CreateCCAnimation() override { |
| 421 scoped_ptr<cc::AnimationCurve> animation_curve( | 421 scoped_ptr<cc::AnimationCurve> animation_curve( |
| 422 new FloatAnimationCurveAdapter(tween_type(), | 422 new FloatAnimationCurveAdapter(tween_type(), |
| 423 start_, | 423 start_, |
| 424 target_, | 424 target_, |
| 425 duration())); | 425 duration())); |
| 426 scoped_ptr<cc::Animation> animation( | 426 scoped_ptr<cc::Animation> animation(cc::Animation::Create( |
| 427 cc::Animation::Create(std::move(animation_curve), animation_id(), | 427 std::move(animation_curve), animation_id(), animation_group_id(), |
| 428 animation_group_id(), cc::Animation::OPACITY)); | 428 cc::TargetProperty::OPACITY)); |
| 429 return animation; | 429 return animation; |
| 430 } | 430 } |
| 431 | 431 |
| 432 void OnGetTarget(TargetValue* target) const override { | 432 void OnGetTarget(TargetValue* target) const override { |
| 433 target->opacity = target_; | 433 target->opacity = target_; |
| 434 } | 434 } |
| 435 | 435 |
| 436 private: | 436 private: |
| 437 float start_; | 437 float start_; |
| 438 const float target_; | 438 const float target_; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 469 void OnEnd(LayerAnimationDelegate* delegate) override { | 469 void OnEnd(LayerAnimationDelegate* delegate) override { |
| 470 delegate->SetTransformFromAnimation(target_); | 470 delegate->SetTransformFromAnimation(target_); |
| 471 } | 471 } |
| 472 | 472 |
| 473 scoped_ptr<cc::Animation> CreateCCAnimation() override { | 473 scoped_ptr<cc::Animation> CreateCCAnimation() override { |
| 474 scoped_ptr<cc::AnimationCurve> animation_curve( | 474 scoped_ptr<cc::AnimationCurve> animation_curve( |
| 475 new TransformAnimationCurveAdapter(tween_type(), | 475 new TransformAnimationCurveAdapter(tween_type(), |
| 476 start_, | 476 start_, |
| 477 target_, | 477 target_, |
| 478 duration())); | 478 duration())); |
| 479 scoped_ptr<cc::Animation> animation( | 479 scoped_ptr<cc::Animation> animation(cc::Animation::Create( |
| 480 cc::Animation::Create(std::move(animation_curve), animation_id(), | 480 std::move(animation_curve), animation_id(), animation_group_id(), |
| 481 animation_group_id(), cc::Animation::TRANSFORM)); | 481 cc::TargetProperty::TRANSFORM)); |
| 482 return animation; | 482 return animation; |
| 483 } | 483 } |
| 484 | 484 |
| 485 void OnGetTarget(TargetValue* target) const override { | 485 void OnGetTarget(TargetValue* target) const override { |
| 486 target->transform = target_; | 486 target->transform = target_; |
| 487 } | 487 } |
| 488 | 488 |
| 489 private: | 489 private: |
| 490 gfx::Transform start_; | 490 gfx::Transform start_; |
| 491 const gfx::Transform target_; | 491 const gfx::Transform target_; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 ThreadedLayerAnimationElement::OnAbort(delegate); | 541 ThreadedLayerAnimationElement::OnAbort(delegate); |
| 542 delegate->SetTransformFromAnimation(ComputeCurrentTransform()); | 542 delegate->SetTransformFromAnimation(ComputeCurrentTransform()); |
| 543 } | 543 } |
| 544 } | 544 } |
| 545 | 545 |
| 546 void OnEnd(LayerAnimationDelegate* delegate) override { | 546 void OnEnd(LayerAnimationDelegate* delegate) override { |
| 547 delegate->SetTransformFromAnimation(computed_target_transform_); | 547 delegate->SetTransformFromAnimation(computed_target_transform_); |
| 548 } | 548 } |
| 549 | 549 |
| 550 scoped_ptr<cc::Animation> CreateCCAnimation() override { | 550 scoped_ptr<cc::Animation> CreateCCAnimation() override { |
| 551 scoped_ptr<cc::Animation> animation( | 551 scoped_ptr<cc::Animation> animation(cc::Animation::Create( |
| 552 cc::Animation::Create(animation_curve_->Clone(), animation_id(), | 552 animation_curve_->Clone(), animation_id(), animation_group_id(), |
| 553 animation_group_id(), cc::Animation::TRANSFORM)); | 553 cc::TargetProperty::TRANSFORM)); |
| 554 return animation; | 554 return animation; |
| 555 } | 555 } |
| 556 | 556 |
| 557 void OnGetTarget(TargetValue* target) const override { | 557 void OnGetTarget(TargetValue* target) const override { |
| 558 target->transform = computed_target_transform_; | 558 target->transform = computed_target_transform_; |
| 559 } | 559 } |
| 560 | 560 |
| 561 private: | 561 private: |
| 562 gfx::Transform ComputeCurrentTransform() const { | 562 gfx::Transform ComputeCurrentTransform() const { |
| 563 gfx::Transform base_current = gfx::Tween::TransformValueBetween( | 563 gfx::Transform base_current = gfx::Tween::TransformValueBetween( |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 } | 735 } |
| 736 | 736 |
| 737 void LayerAnimationElement::RequestEffectiveStart( | 737 void LayerAnimationElement::RequestEffectiveStart( |
| 738 LayerAnimationDelegate* delegate) { | 738 LayerAnimationDelegate* delegate) { |
| 739 DCHECK(requested_start_time_ != base::TimeTicks()); | 739 DCHECK(requested_start_time_ != base::TimeTicks()); |
| 740 effective_start_time_ = requested_start_time_; | 740 effective_start_time_ = requested_start_time_; |
| 741 } | 741 } |
| 742 | 742 |
| 743 // static | 743 // static |
| 744 LayerAnimationElement::AnimatableProperty | 744 LayerAnimationElement::AnimatableProperty |
| 745 LayerAnimationElement::ToAnimatableProperty( | 745 LayerAnimationElement::ToAnimatableProperty(cc::TargetProperty::Type property) { |
| 746 cc::Animation::TargetProperty property) { | |
| 747 switch (property) { | 746 switch (property) { |
| 748 case cc::Animation::TRANSFORM: | 747 case cc::TargetProperty::TRANSFORM: |
| 749 return TRANSFORM; | 748 return TRANSFORM; |
| 750 case cc::Animation::OPACITY: | 749 case cc::TargetProperty::OPACITY: |
| 751 return OPACITY; | 750 return OPACITY; |
| 752 default: | 751 default: |
| 753 NOTREACHED(); | 752 NOTREACHED(); |
| 754 return AnimatableProperty(); | 753 return AnimatableProperty(); |
| 755 } | 754 } |
| 756 } | 755 } |
| 757 | 756 |
| 758 // static | 757 // static |
| 759 base::TimeDelta LayerAnimationElement::GetEffectiveDuration( | 758 base::TimeDelta LayerAnimationElement::GetEffectiveDuration( |
| 760 const base::TimeDelta& duration) { | 759 const base::TimeDelta& duration) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 } | 845 } |
| 847 | 846 |
| 848 // static | 847 // static |
| 849 LayerAnimationElement* LayerAnimationElement::CreateColorElement( | 848 LayerAnimationElement* LayerAnimationElement::CreateColorElement( |
| 850 SkColor color, | 849 SkColor color, |
| 851 base::TimeDelta duration) { | 850 base::TimeDelta duration) { |
| 852 return new ColorTransition(color, duration); | 851 return new ColorTransition(color, duration); |
| 853 } | 852 } |
| 854 | 853 |
| 855 } // namespace ui | 854 } // namespace ui |
| OLD | NEW |