Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: cc/trees/layer_tree_host_unittest.cc

Issue 2835213002: cc: Add mask tiling unit tests (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 6547 matching lines...) Expand 10 before | Expand all | Expand 10 after
6558 6558
6559 private: 6559 private:
6560 scoped_refptr<Layer> root; 6560 scoped_refptr<Layer> root;
6561 scoped_refptr<Layer> child; 6561 scoped_refptr<Layer> child;
6562 }; 6562 };
6563 6563
6564 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestUpdateCopyRequests); 6564 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestUpdateCopyRequests);
6565 6565
6566 class LayerTreeTestMaskLayerForSurfaceWithContentRectNotAtOrigin 6566 class LayerTreeTestMaskLayerForSurfaceWithContentRectNotAtOrigin
6567 : public LayerTreeTest { 6567 : public LayerTreeTest {
6568 public:
enne (OOO) 2017/04/24 18:31:30 Accidental?
sunxd 2017/04/26 14:27:31 Done.
6568 protected: 6569 protected:
6569 void SetupTree() override { 6570 void SetupTree() override {
6570 // The masked layer has bounds 50x50, but it has a child that causes 6571 // The masked layer has bounds 50x50, but it has a child that causes
6571 // the surface bounds to be larger. It also has a parent that clips the 6572 // the surface bounds to be larger. It also has a parent that clips the
6572 // masked layer and its surface. 6573 // masked layer and its surface.
6573 6574
6574 scoped_refptr<Layer> root = Layer::Create(); 6575 scoped_refptr<Layer> root = Layer::Create();
6575 6576
6576 scoped_refptr<FakePictureLayer> content_layer = 6577 scoped_refptr<FakePictureLayer> content_layer =
6577 FakePictureLayer::Create(&client_); 6578 FakePictureLayer::Create(&client_);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
6651 EndTest(); 6652 EndTest();
6652 return draw_result; 6653 return draw_result;
6653 } 6654 }
6654 6655
6655 void AfterTest() override {} 6656 void AfterTest() override {}
6656 6657
6657 int mask_layer_id_; 6658 int mask_layer_id_;
6658 FakeContentLayerClient client_; 6659 FakeContentLayerClient client_;
6659 }; 6660 };
6660 6661
6662 class LayerTreeTestSingleTextureMaskLayerForSurfaceWithContentRectNotAtOrigin
6663 : public LayerTreeTestMaskLayerForSurfaceWithContentRectNotAtOrigin {
6664 public:
6665 void InitializeSettings(LayerTreeSettings* settings) override {
6666 settings->enable_mask_tiling = false;
6667 }
6668 };
6669
6661 SINGLE_AND_MULTI_THREAD_TEST_F( 6670 SINGLE_AND_MULTI_THREAD_TEST_F(
6662 LayerTreeTestMaskLayerForSurfaceWithContentRectNotAtOrigin); 6671 LayerTreeTestSingleTextureMaskLayerForSurfaceWithContentRectNotAtOrigin);
6672
6673 class LayerTreeTestMultiTextureMaskLayerForSurfaceWithContentRectNotAtOrigin
6674 : public LayerTreeTestMaskLayerForSurfaceWithContentRectNotAtOrigin {
6675 public:
6676 void InitializeSettings(LayerTreeSettings* settings) override {
6677 settings->enable_mask_tiling = true;
6678 }
6679 };
6680
6681 SINGLE_AND_MULTI_THREAD_TEST_F(
6682 LayerTreeTestMultiTextureMaskLayerForSurfaceWithContentRectNotAtOrigin);
6663 6683
6664 class LayerTreeTestMaskLayerForSurfaceWithClippedLayer : public LayerTreeTest { 6684 class LayerTreeTestMaskLayerForSurfaceWithClippedLayer : public LayerTreeTest {
6665 protected: 6685 protected:
6666 void SetupTree() override { 6686 void SetupTree() override {
6667 // The masked layer has bounds 50x50, but it has a child that causes 6687 // 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 6688 // the surface bounds to be larger. It also has a parent that clips the
6669 // masked layer and its surface. 6689 // masked layer and its surface.
6670 6690
6671 scoped_refptr<Layer> root = Layer::Create(); 6691 scoped_refptr<Layer> root = Layer::Create();
6672 6692
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
6764 EndTest(); 6784 EndTest();
6765 return draw_result; 6785 return draw_result;
6766 } 6786 }
6767 6787
6768 void AfterTest() override {} 6788 void AfterTest() override {}
6769 6789
6770 int mask_layer_id_; 6790 int mask_layer_id_;
6771 FakeContentLayerClient client_; 6791 FakeContentLayerClient client_;
6772 }; 6792 };
6773 6793
6794 class LayerTreeTestSingleTextureMaskLayerForSurfaceWithClippedLayer
6795 : public LayerTreeTestMaskLayerForSurfaceWithClippedLayer {
6796 public:
6797 void InitializeSettings(LayerTreeSettings* settings) override {
6798 settings->enable_mask_tiling = false;
6799 }
6800 };
6801
6774 SINGLE_AND_MULTI_THREAD_TEST_F( 6802 SINGLE_AND_MULTI_THREAD_TEST_F(
6775 LayerTreeTestMaskLayerForSurfaceWithClippedLayer); 6803 LayerTreeTestSingleTextureMaskLayerForSurfaceWithClippedLayer);
6804
6805 class LayerTreeTestMultiTextureMaskLayerForSurfaceWithClippedLayer
6806 : public LayerTreeTestMaskLayerForSurfaceWithClippedLayer {
6807 public:
6808 void InitializeSettings(LayerTreeSettings* settings) override {
6809 settings->enable_mask_tiling = true;
6810 }
6811 };
6812
6813 SINGLE_AND_MULTI_THREAD_TEST_F(
6814 LayerTreeTestMultiTextureMaskLayerForSurfaceWithClippedLayer);
6776 6815
6777 class LayerTreeTestMaskLayerWithScaling : public LayerTreeTest { 6816 class LayerTreeTestMaskLayerWithScaling : public LayerTreeTest {
6778 protected: 6817 protected:
6779 void InitializeSettings(LayerTreeSettings* settings) override {
6780 settings->layer_transforms_should_scale_layer_contents = true;
6781 }
6782
6783 void SetupTree() override { 6818 void SetupTree() override {
6784 // Root 6819 // Root
6785 // | 6820 // |
6786 // +-- Scaling Layer (adds a 2x scale) 6821 // +-- Scaling Layer (adds a 2x scale)
6787 // | 6822 // |
6788 // +-- Content Layer 6823 // +-- Content Layer
6789 // +--Mask 6824 // +--Mask
6790 6825
6791 scoped_refptr<Layer> root = Layer::Create(); 6826 scoped_refptr<Layer> root = Layer::Create();
6792 6827
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
6888 layer_tree_host()->SetDeviceScaleFactor(2.f); 6923 layer_tree_host()->SetDeviceScaleFactor(2.f);
6889 break; 6924 break;
6890 } 6925 }
6891 } 6926 }
6892 6927
6893 void AfterTest() override {} 6928 void AfterTest() override {}
6894 6929
6895 FakeContentLayerClient client_; 6930 FakeContentLayerClient client_;
6896 }; 6931 };
6897 6932
6898 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithScaling); 6933 class LayerTreeTestSingleTextureMaskLayerWithScaling
6934 : public LayerTreeTestMaskLayerWithScaling {
6935 public:
6936 void InitializeSettings(LayerTreeSettings* settings) override {
6937 settings->enable_mask_tiling = false;
6938 settings->layer_transforms_should_scale_layer_contents = true;
6939 }
6940 };
6941
6942 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestSingleTextureMaskLayerWithScaling);
6943
6944 class LayerTreeTestMultiTextureMaskLayerWithScaling
6945 : public LayerTreeTestMaskLayerWithScaling {
6946 public:
6947 void InitializeSettings(LayerTreeSettings* settings) override {
6948 settings->enable_mask_tiling = true;
6949 settings->layer_transforms_should_scale_layer_contents = true;
6950 }
6951 };
6952
6953 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMultiTextureMaskLayerWithScaling);
6899 6954
6900 class LayerTreeTestMaskLayerWithDifferentBounds : public LayerTreeTest { 6955 class LayerTreeTestMaskLayerWithDifferentBounds : public LayerTreeTest {
6901 protected: 6956 protected:
6902 void SetupTree() override { 6957 void SetupTree() override {
6903 // The mask layer has bounds 100x100 but is attached to a layer with bounds 6958 // The mask layer has bounds 100x100 but is attached to a layer with bounds
6904 // 50x50. 6959 // 50x50.
6905 6960
6906 scoped_refptr<Layer> root = Layer::Create(); 6961 scoped_refptr<Layer> root = Layer::Create();
6907 6962
6908 scoped_refptr<FakePictureLayer> content_layer = 6963 scoped_refptr<FakePictureLayer> content_layer =
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
6993 layer_tree_host()->SetDeviceScaleFactor(2.f); 7048 layer_tree_host()->SetDeviceScaleFactor(2.f);
6994 break; 7049 break;
6995 } 7050 }
6996 } 7051 }
6997 7052
6998 void AfterTest() override {} 7053 void AfterTest() override {}
6999 7054
7000 FakeContentLayerClient client_; 7055 FakeContentLayerClient client_;
7001 }; 7056 };
7002 7057
7003 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskLayerWithDifferentBounds); 7058 class LayerTreeTestSingleTextureMaskLayerWithDifferentBounds
7059 : public LayerTreeTestMaskLayerWithDifferentBounds {
7060 public:
7061 void InitializeSettings(LayerTreeSettings* settings) override {
7062 settings->enable_mask_tiling = false;
7063 }
7064 };
7065
7066 SINGLE_AND_MULTI_THREAD_TEST_F(
7067 LayerTreeTestSingleTextureMaskLayerWithDifferentBounds);
7068
7069 class LayerTreeTestMultiTextureMaskLayerWithDifferentBounds
7070 : public LayerTreeTestMaskLayerWithDifferentBounds {
7071 public:
7072 void InitializeSettings(LayerTreeSettings* settings) override {
7073 settings->enable_mask_tiling = true;
7074 }
7075 };
7076
7077 SINGLE_AND_MULTI_THREAD_TEST_F(
7078 LayerTreeTestMultiTextureMaskLayerWithDifferentBounds);
7004 7079
7005 class LayerTreeTestPageScaleFlags : public LayerTreeTest { 7080 class LayerTreeTestPageScaleFlags : public LayerTreeTest {
7006 protected: 7081 protected:
7007 void SetupTree() override { 7082 void SetupTree() override {
7008 // -root 7083 // -root
7009 // -pre page scale 7084 // -pre page scale
7010 // -page scale 7085 // -page scale
7011 // -page scale child1 7086 // -page scale child1
7012 // -page scale grandchild 7087 // -page scale grandchild
7013 // -page scale child2 7088 // -page scale child2
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
7595 void AfterTest() override {} 7670 void AfterTest() override {}
7596 7671
7597 private: 7672 private:
7598 bool received_ack_ = false; 7673 bool received_ack_ = false;
7599 }; 7674 };
7600 7675
7601 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDiscardAckAfterRelease); 7676 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDiscardAckAfterRelease);
7602 7677
7603 } // namespace 7678 } // namespace
7604 } // namespace cc 7679 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698