| 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 6640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6651 EndTest(); | 6651 EndTest(); |
| 6652 return draw_result; | 6652 return draw_result; |
| 6653 } | 6653 } |
| 6654 | 6654 |
| 6655 void AfterTest() override {} | 6655 void AfterTest() override {} |
| 6656 | 6656 |
| 6657 int mask_layer_id_; | 6657 int mask_layer_id_; |
| 6658 FakeContentLayerClient client_; | 6658 FakeContentLayerClient client_; |
| 6659 }; | 6659 }; |
| 6660 | 6660 |
| 6661 class LayerTreeTestSingleTextureMaskLayerForSurfaceWithContentRectNotAtOrigin |
| 6662 : public LayerTreeTestMaskLayerForSurfaceWithContentRectNotAtOrigin { |
| 6663 public: |
| 6664 void InitializeSettings(LayerTreeSettings* settings) override { |
| 6665 settings->enable_mask_tiling = false; |
| 6666 } |
| 6667 }; |
| 6668 |
| 6661 SINGLE_AND_MULTI_THREAD_TEST_F( | 6669 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 6662 LayerTreeTestMaskLayerForSurfaceWithContentRectNotAtOrigin); | 6670 LayerTreeTestSingleTextureMaskLayerForSurfaceWithContentRectNotAtOrigin); |
| 6671 |
| 6672 class LayerTreeTestMultiTextureMaskLayerForSurfaceWithContentRectNotAtOrigin |
| 6673 : public LayerTreeTestMaskLayerForSurfaceWithContentRectNotAtOrigin { |
| 6674 public: |
| 6675 void InitializeSettings(LayerTreeSettings* settings) override { |
| 6676 settings->enable_mask_tiling = true; |
| 6677 } |
| 6678 }; |
| 6679 |
| 6680 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 6681 LayerTreeTestMultiTextureMaskLayerForSurfaceWithContentRectNotAtOrigin); |
| 6663 | 6682 |
| 6664 class LayerTreeTestMaskLayerForSurfaceWithClippedLayer : public LayerTreeTest { | 6683 class LayerTreeTestMaskLayerForSurfaceWithClippedLayer : public LayerTreeTest { |
| 6665 protected: | 6684 protected: |
| 6666 void SetupTree() override { | 6685 void SetupTree() override { |
| 6667 // The masked layer has bounds 50x50, but it has a child that causes | 6686 // The masked layer has bounds 50x50, but it has a child that causes |
| 6668 // the surface bounds to be larger. It also has a parent that clips the | 6687 // the surface bounds to be larger. It also has a parent that clips the |
| 6669 // masked layer and its surface. | 6688 // masked layer and its surface. |
| 6670 | 6689 |
| 6671 scoped_refptr<Layer> root = Layer::Create(); | 6690 scoped_refptr<Layer> root = Layer::Create(); |
| 6672 | 6691 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6764 EndTest(); | 6783 EndTest(); |
| 6765 return draw_result; | 6784 return draw_result; |
| 6766 } | 6785 } |
| 6767 | 6786 |
| 6768 void AfterTest() override {} | 6787 void AfterTest() override {} |
| 6769 | 6788 |
| 6770 int mask_layer_id_; | 6789 int mask_layer_id_; |
| 6771 FakeContentLayerClient client_; | 6790 FakeContentLayerClient client_; |
| 6772 }; | 6791 }; |
| 6773 | 6792 |
| 6793 class LayerTreeTestSingleTextureMaskLayerForSurfaceWithClippedLayer |
| 6794 : public LayerTreeTestMaskLayerForSurfaceWithClippedLayer { |
| 6795 public: |
| 6796 void InitializeSettings(LayerTreeSettings* settings) override { |
| 6797 settings->enable_mask_tiling = false; |
| 6798 } |
| 6799 }; |
| 6800 |
| 6774 SINGLE_AND_MULTI_THREAD_TEST_F( | 6801 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 6775 LayerTreeTestMaskLayerForSurfaceWithClippedLayer); | 6802 LayerTreeTestSingleTextureMaskLayerForSurfaceWithClippedLayer); |
| 6803 |
| 6804 class LayerTreeTestMultiTextureMaskLayerForSurfaceWithClippedLayer |
| 6805 : public LayerTreeTestMaskLayerForSurfaceWithClippedLayer { |
| 6806 public: |
| 6807 void InitializeSettings(LayerTreeSettings* settings) override { |
| 6808 settings->enable_mask_tiling = true; |
| 6809 } |
| 6810 }; |
| 6811 |
| 6812 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 6813 LayerTreeTestMultiTextureMaskLayerForSurfaceWithClippedLayer); |
| 6776 | 6814 |
| 6777 class LayerTreeTestMaskLayerWithScaling : public LayerTreeTest { | 6815 class LayerTreeTestMaskLayerWithScaling : public LayerTreeTest { |
| 6778 protected: | 6816 protected: |
| 6779 void InitializeSettings(LayerTreeSettings* settings) override { | |
| 6780 settings->layer_transforms_should_scale_layer_contents = true; | |
| 6781 } | |
| 6782 | |
| 6783 void SetupTree() override { | 6817 void SetupTree() override { |
| 6784 // Root | 6818 // Root |
| 6785 // | | 6819 // | |
| 6786 // +-- Scaling Layer (adds a 2x scale) | 6820 // +-- Scaling Layer (adds a 2x scale) |
| 6787 // | | 6821 // | |
| 6788 // +-- Content Layer | 6822 // +-- Content Layer |
| 6789 // +--Mask | 6823 // +--Mask |
| 6790 | 6824 |
| 6791 scoped_refptr<Layer> root = Layer::Create(); | 6825 scoped_refptr<Layer> root = Layer::Create(); |
| 6792 | 6826 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6888 layer_tree_host()->SetDeviceScaleFactor(2.f); | 6922 layer_tree_host()->SetDeviceScaleFactor(2.f); |
| 6889 break; | 6923 break; |
| 6890 } | 6924 } |
| 6891 } | 6925 } |
| 6892 | 6926 |
| 6893 void AfterTest() override {} | 6927 void AfterTest() override {} |
| 6894 | 6928 |
| 6895 FakeContentLayerClient client_; | 6929 FakeContentLayerClient client_; |
| 6896 }; | 6930 }; |
| 6897 | 6931 |
| 6898 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithScaling); | 6932 class LayerTreeTestSingleTextureMaskLayerWithScaling |
| 6933 : public LayerTreeTestMaskLayerWithScaling { |
| 6934 public: |
| 6935 void InitializeSettings(LayerTreeSettings* settings) override { |
| 6936 settings->enable_mask_tiling = false; |
| 6937 settings->layer_transforms_should_scale_layer_contents = true; |
| 6938 } |
| 6939 }; |
| 6940 |
| 6941 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestSingleTextureMaskLayerWithScaling); |
| 6942 |
| 6943 class LayerTreeTestMultiTextureMaskLayerWithScaling |
| 6944 : public LayerTreeTestMaskLayerWithScaling { |
| 6945 public: |
| 6946 void InitializeSettings(LayerTreeSettings* settings) override { |
| 6947 settings->enable_mask_tiling = true; |
| 6948 settings->layer_transforms_should_scale_layer_contents = true; |
| 6949 } |
| 6950 }; |
| 6951 |
| 6952 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMultiTextureMaskLayerWithScaling); |
| 6899 | 6953 |
| 6900 class LayerTreeTestMaskLayerWithDifferentBounds : public LayerTreeTest { | 6954 class LayerTreeTestMaskLayerWithDifferentBounds : public LayerTreeTest { |
| 6901 protected: | 6955 protected: |
| 6902 void SetupTree() override { | 6956 void SetupTree() override { |
| 6903 // The mask layer has bounds 100x100 but is attached to a layer with bounds | 6957 // The mask layer has bounds 100x100 but is attached to a layer with bounds |
| 6904 // 50x50. | 6958 // 50x50. |
| 6905 | 6959 |
| 6906 scoped_refptr<Layer> root = Layer::Create(); | 6960 scoped_refptr<Layer> root = Layer::Create(); |
| 6907 | 6961 |
| 6908 scoped_refptr<FakePictureLayer> content_layer = | 6962 scoped_refptr<FakePictureLayer> content_layer = |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6993 layer_tree_host()->SetDeviceScaleFactor(2.f); | 7047 layer_tree_host()->SetDeviceScaleFactor(2.f); |
| 6994 break; | 7048 break; |
| 6995 } | 7049 } |
| 6996 } | 7050 } |
| 6997 | 7051 |
| 6998 void AfterTest() override {} | 7052 void AfterTest() override {} |
| 6999 | 7053 |
| 7000 FakeContentLayerClient client_; | 7054 FakeContentLayerClient client_; |
| 7001 }; | 7055 }; |
| 7002 | 7056 |
| 7003 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithDifferentBounds); | 7057 class LayerTreeTestSingleTextureMaskLayerWithDifferentBounds |
| 7058 : public LayerTreeTestMaskLayerWithDifferentBounds { |
| 7059 public: |
| 7060 void InitializeSettings(LayerTreeSettings* settings) override { |
| 7061 settings->enable_mask_tiling = false; |
| 7062 } |
| 7063 }; |
| 7064 |
| 7065 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 7066 LayerTreeTestSingleTextureMaskLayerWithDifferentBounds); |
| 7067 |
| 7068 class LayerTreeTestMultiTextureMaskLayerWithDifferentBounds |
| 7069 : public LayerTreeTestMaskLayerWithDifferentBounds { |
| 7070 public: |
| 7071 void InitializeSettings(LayerTreeSettings* settings) override { |
| 7072 settings->enable_mask_tiling = true; |
| 7073 } |
| 7074 }; |
| 7075 |
| 7076 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 7077 LayerTreeTestMultiTextureMaskLayerWithDifferentBounds); |
| 7004 | 7078 |
| 7005 class LayerTreeTestPageScaleFlags : public LayerTreeTest { | 7079 class LayerTreeTestPageScaleFlags : public LayerTreeTest { |
| 7006 protected: | 7080 protected: |
| 7007 void SetupTree() override { | 7081 void SetupTree() override { |
| 7008 // -root | 7082 // -root |
| 7009 // -pre page scale | 7083 // -pre page scale |
| 7010 // -page scale | 7084 // -page scale |
| 7011 // -page scale child1 | 7085 // -page scale child1 |
| 7012 // -page scale grandchild | 7086 // -page scale grandchild |
| 7013 // -page scale child2 | 7087 // -page scale child2 |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7595 void AfterTest() override {} | 7669 void AfterTest() override {} |
| 7596 | 7670 |
| 7597 private: | 7671 private: |
| 7598 bool received_ack_ = false; | 7672 bool received_ack_ = false; |
| 7599 }; | 7673 }; |
| 7600 | 7674 |
| 7601 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDiscardAckAfterRelease); | 7675 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDiscardAckAfterRelease); |
| 7602 | 7676 |
| 7603 } // namespace | 7677 } // namespace |
| 7604 } // namespace cc | 7678 } // namespace cc |
| OLD | NEW |