OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/layers/layer.h" | 5 #include "cc/layers/layer.h" |
6 | 6 |
7 #include "cc/animation/keyframed_animation_curve.h" | 7 #include "cc/animation/keyframed_animation_curve.h" |
8 #include "cc/base/math_util.h" | 8 #include "cc/base/math_util.h" |
9 #include "cc/base/thread.h" | 9 #include "cc/base/thread.h" |
10 #include "cc/layers/layer_impl.h" | 10 #include "cc/layers/layer_impl.h" |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 TEST_F(LayerTest, | 651 TEST_F(LayerTest, |
652 PushPropertiesDoesNotCauseSurfacePropertyChangedDuringImplOnlyTransformAn
imation) { | 652 PushPropertiesDoesNotCauseSurfacePropertyChangedDuringImplOnlyTransformAn
imation) { |
653 scoped_refptr<Layer> test_layer = Layer::Create(); | 653 scoped_refptr<Layer> test_layer = Layer::Create(); |
654 scoped_ptr<LayerImpl> impl_layer = | 654 scoped_ptr<LayerImpl> impl_layer = |
655 LayerImpl::Create(host_impl_.active_tree(), 1); | 655 LayerImpl::Create(host_impl_.active_tree(), 1); |
656 | 656 |
657 scoped_ptr<AnimationRegistrar> registrar = AnimationRegistrar::Create(); | 657 scoped_ptr<AnimationRegistrar> registrar = AnimationRegistrar::Create(); |
658 impl_layer->layer_animation_controller()->SetAnimationRegistrar( | 658 impl_layer->layer_animation_controller()->SetAnimationRegistrar( |
659 registrar.get()); | 659 registrar.get()); |
660 | 660 |
661 addAnimatedTransformToController(*impl_layer->layer_animation_controller(), | 661 AddAnimatedTransformToController(impl_layer->layer_animation_controller(), |
662 1.0, | 662 1.0, |
663 0, | 663 0, |
664 100); | 664 100); |
665 | 665 |
666 gfx::Transform transform; | 666 gfx::Transform transform; |
667 transform.Rotate(45.0); | 667 transform.Rotate(45.0); |
668 test_layer->SetTransform(transform); | 668 test_layer->SetTransform(transform); |
669 | 669 |
670 EXPECT_FALSE(impl_layer->LayerSurfacePropertyChanged()); | 670 EXPECT_FALSE(impl_layer->LayerSurfacePropertyChanged()); |
671 test_layer->PushPropertiesTo(impl_layer.get()); | 671 test_layer->PushPropertiesTo(impl_layer.get()); |
672 EXPECT_TRUE(impl_layer->LayerSurfacePropertyChanged()); | 672 EXPECT_TRUE(impl_layer->LayerSurfacePropertyChanged()); |
673 | 673 |
674 impl_layer->ResetAllChangeTrackingForSubtree(); | 674 impl_layer->ResetAllChangeTrackingForSubtree(); |
675 addAnimatedTransformToController(*impl_layer->layer_animation_controller(), | 675 AddAnimatedTransformToController(impl_layer->layer_animation_controller(), |
676 1.0, | 676 1.0, |
677 0, | 677 0, |
678 100); | 678 100); |
679 impl_layer->layer_animation_controller()->GetAnimation(Animation::Transform)-> | 679 impl_layer->layer_animation_controller()->GetAnimation(Animation::Transform)-> |
680 set_is_impl_only(true); | 680 set_is_impl_only(true); |
681 transform.Rotate(45.0); | 681 transform.Rotate(45.0); |
682 test_layer->SetTransform(transform); | 682 test_layer->SetTransform(transform); |
683 | 683 |
684 EXPECT_FALSE(impl_layer->LayerSurfacePropertyChanged()); | 684 EXPECT_FALSE(impl_layer->LayerSurfacePropertyChanged()); |
685 test_layer->PushPropertiesTo(impl_layer.get()); | 685 test_layer->PushPropertiesTo(impl_layer.get()); |
686 EXPECT_FALSE(impl_layer->LayerSurfacePropertyChanged()); | 686 EXPECT_FALSE(impl_layer->LayerSurfacePropertyChanged()); |
687 } | 687 } |
688 | 688 |
689 TEST_F(LayerTest, | 689 TEST_F(LayerTest, |
690 PushPropertiesDoesNotCauseSurfacePropertyChangedDuringImplOnlyOpacityAnim
ation) { | 690 PushPropertiesDoesNotCauseSurfacePropertyChangedDuringImplOnlyOpacityAnim
ation) { |
691 scoped_refptr<Layer> test_layer = Layer::Create(); | 691 scoped_refptr<Layer> test_layer = Layer::Create(); |
692 scoped_ptr<LayerImpl> impl_layer = | 692 scoped_ptr<LayerImpl> impl_layer = |
693 LayerImpl::Create(host_impl_.active_tree(), 1); | 693 LayerImpl::Create(host_impl_.active_tree(), 1); |
694 | 694 |
695 scoped_ptr<AnimationRegistrar> registrar = AnimationRegistrar::Create(); | 695 scoped_ptr<AnimationRegistrar> registrar = AnimationRegistrar::Create(); |
696 impl_layer->layer_animation_controller()->SetAnimationRegistrar( | 696 impl_layer->layer_animation_controller()->SetAnimationRegistrar( |
697 registrar.get()); | 697 registrar.get()); |
698 | 698 |
699 addOpacityTransitionToController(*impl_layer->layer_animation_controller(), | 699 AddOpacityTransitionToController(impl_layer->layer_animation_controller(), |
700 1.0, | 700 1.0, |
701 0.3f, | 701 0.3f, |
702 0.7f, | 702 0.7f, |
703 false); | 703 false); |
704 | 704 |
705 test_layer->SetOpacity(0.5f); | 705 test_layer->SetOpacity(0.5f); |
706 | 706 |
707 EXPECT_FALSE(impl_layer->LayerSurfacePropertyChanged()); | 707 EXPECT_FALSE(impl_layer->LayerSurfacePropertyChanged()); |
708 test_layer->PushPropertiesTo(impl_layer.get()); | 708 test_layer->PushPropertiesTo(impl_layer.get()); |
709 EXPECT_TRUE(impl_layer->LayerSurfacePropertyChanged()); | 709 EXPECT_TRUE(impl_layer->LayerSurfacePropertyChanged()); |
710 | 710 |
711 impl_layer->ResetAllChangeTrackingForSubtree(); | 711 impl_layer->ResetAllChangeTrackingForSubtree(); |
712 addOpacityTransitionToController(*impl_layer->layer_animation_controller(), | 712 AddOpacityTransitionToController(impl_layer->layer_animation_controller(), |
713 1.0, | 713 1.0, |
714 0.3f, | 714 0.3f, |
715 0.7f, | 715 0.7f, |
716 false); | 716 false); |
717 impl_layer->layer_animation_controller()->GetAnimation(Animation::Opacity)-> | 717 impl_layer->layer_animation_controller()->GetAnimation(Animation::Opacity)-> |
718 set_is_impl_only(true); | 718 set_is_impl_only(true); |
719 test_layer->SetOpacity(0.75f); | 719 test_layer->SetOpacity(0.75f); |
720 | 720 |
721 EXPECT_FALSE(impl_layer->LayerSurfacePropertyChanged()); | 721 EXPECT_FALSE(impl_layer->LayerSurfacePropertyChanged()); |
722 test_layer->PushPropertiesTo(impl_layer.get()); | 722 test_layer->PushPropertiesTo(impl_layer.get()); |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 layer->SetLayerTreeHost(layer_tree_host.get()); | 1002 layer->SetLayerTreeHost(layer_tree_host.get()); |
1003 AssertLayerTreeHostMatchesForSubtree(layer.get(), layer_tree_host.get()); | 1003 AssertLayerTreeHostMatchesForSubtree(layer.get(), layer_tree_host.get()); |
1004 | 1004 |
1005 // Case 3: with a LayerTreeHost where accelerated animation is disabled, the | 1005 // Case 3: with a LayerTreeHost where accelerated animation is disabled, the |
1006 // animation should be rejected. | 1006 // animation should be rejected. |
1007 EXPECT_FALSE(AddTestAnimation(layer.get())); | 1007 EXPECT_FALSE(AddTestAnimation(layer.get())); |
1008 } | 1008 } |
1009 | 1009 |
1010 } // namespace | 1010 } // namespace |
1011 } // namespace cc | 1011 } // namespace cc |
OLD | NEW |