| 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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 protected: | 692 protected: |
| 693 void SetupTree() override { | 693 void SetupTree() override { |
| 694 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 694 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 695 layer_tree_host()->SetRootLayer(root); | 695 layer_tree_host()->SetRootLayer(root); |
| 696 LayerTreeHostTest::SetupTree(); | 696 LayerTreeHostTest::SetupTree(); |
| 697 } | 697 } |
| 698 | 698 |
| 699 enum Animations { | 699 enum Animations { |
| 700 OPACITY, | 700 OPACITY, |
| 701 TRANSFORM, | 701 TRANSFORM, |
| 702 FILTER, |
| 702 END, | 703 END, |
| 703 }; | 704 }; |
| 704 | 705 |
| 705 void BeginTest() override { | 706 void BeginTest() override { |
| 706 index_ = OPACITY; | 707 index_ = OPACITY; |
| 707 PostSetNeedsCommitToMainThread(); | 708 PostSetNeedsCommitToMainThread(); |
| 708 } | 709 } |
| 709 | 710 |
| 710 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { | 711 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { |
| 711 gfx::Transform transform; | 712 gfx::Transform transform; |
| 713 FilterOperations filters; |
| 712 switch (static_cast<Animations>(index_)) { | 714 switch (static_cast<Animations>(index_)) { |
| 713 case OPACITY: | 715 case OPACITY: |
| 714 index_++; | 716 index_++; |
| 715 impl->active_tree()->root_layer()->ResetAllChangeTrackingForSubtree(); | 717 impl->active_tree()->root_layer()->ResetAllChangeTrackingForSubtree(); |
| 716 impl->active_tree()->root_layer()->OnOpacityAnimated(0.5f); | 718 impl->active_tree()->root_layer()->OnOpacityAnimated(0.5f); |
| 717 PostSetNeedsCommitToMainThread(); | 719 PostSetNeedsCommitToMainThread(); |
| 718 break; | 720 break; |
| 719 case TRANSFORM: | 721 case TRANSFORM: |
| 720 index_++; | 722 index_++; |
| 721 EXPECT_TRUE(impl->active_tree()->root_layer()->LayerPropertyChanged()); | 723 EXPECT_TRUE(impl->active_tree()->root_layer()->LayerPropertyChanged()); |
| 722 impl->active_tree()->root_layer()->ResetAllChangeTrackingForSubtree(); | 724 impl->active_tree()->root_layer()->ResetAllChangeTrackingForSubtree(); |
| 723 impl->active_tree() | 725 impl->active_tree() |
| 724 ->property_trees() | 726 ->property_trees() |
| 725 ->effect_tree.ResetChangeTracking(); | 727 ->effect_tree.ResetChangeTracking(); |
| 726 EXPECT_FALSE(impl->active_tree()->root_layer()->LayerPropertyChanged()); | 728 EXPECT_FALSE(impl->active_tree()->root_layer()->LayerPropertyChanged()); |
| 727 transform.Translate(10, 10); | 729 transform.Translate(10, 10); |
| 728 impl->active_tree()->root_layer()->OnTransformAnimated(transform); | 730 impl->active_tree()->root_layer()->OnTransformAnimated(transform); |
| 729 PostSetNeedsCommitToMainThread(); | 731 PostSetNeedsCommitToMainThread(); |
| 730 break; | 732 break; |
| 733 case FILTER: |
| 734 index_++; |
| 735 EXPECT_TRUE(impl->active_tree()->root_layer()->LayerPropertyChanged()); |
| 736 impl->active_tree()->root_layer()->ResetAllChangeTrackingForSubtree(); |
| 737 impl->active_tree() |
| 738 ->property_trees() |
| 739 ->transform_tree.ResetChangeTracking(); |
| 740 EXPECT_FALSE(impl->active_tree()->root_layer()->LayerPropertyChanged()); |
| 741 filters.Append(FilterOperation::CreateOpacityFilter(0.5f)); |
| 742 impl->active_tree()->root_layer()->OnFilterAnimated(filters); |
| 743 PostSetNeedsCommitToMainThread(); |
| 744 break; |
| 731 case END: | 745 case END: |
| 732 EXPECT_TRUE(impl->active_tree()->root_layer()->LayerPropertyChanged()); | 746 EXPECT_TRUE(impl->active_tree()->root_layer()->LayerPropertyChanged()); |
| 733 EndTest(); | 747 EndTest(); |
| 734 break; | 748 break; |
| 735 } | 749 } |
| 736 } | 750 } |
| 737 | 751 |
| 738 void AfterTest() override {} | 752 void AfterTest() override {} |
| 739 int index_; | 753 int index_; |
| 740 }; | 754 }; |
| (...skipping 5915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6656 EndTest(); | 6670 EndTest(); |
| 6657 } | 6671 } |
| 6658 | 6672 |
| 6659 void AfterTest() override {} | 6673 void AfterTest() override {} |
| 6660 }; | 6674 }; |
| 6661 | 6675 |
| 6662 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); | 6676 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); |
| 6663 | 6677 |
| 6664 } // namespace | 6678 } // namespace |
| 6665 } // namespace cc | 6679 } // namespace cc |
| OLD | NEW |