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

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

Issue 1122393003: CC: Plumb LayerSettings parameter for cc::Layer construction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 7 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "cc/layers/layer.h" 7 #include "cc/layers/layer.h"
8 #include "cc/layers/picture_layer.h" 8 #include "cc/layers/picture_layer.h"
9 #include "cc/test/fake_content_layer_client.h" 9 #include "cc/test/fake_content_layer_client.h"
10 #include "cc/test/layer_tree_test.h" 10 #include "cc/test/layer_tree_test.h"
(...skipping 12 matching lines...) Expand all
23 void InitializeSettings(LayerTreeSettings* settings) override { 23 void InitializeSettings(LayerTreeSettings* settings) override {
24 settings->minimum_occlusion_tracking_size = gfx::Size(); 24 settings->minimum_occlusion_tracking_size = gfx::Size();
25 } 25 }
26 }; 26 };
27 27
28 // Verify occlusion is set on the layer draw properties. 28 // Verify occlusion is set on the layer draw properties.
29 class LayerTreeHostOcclusionTestDrawPropertiesOnLayer 29 class LayerTreeHostOcclusionTestDrawPropertiesOnLayer
30 : public LayerTreeHostOcclusionTest { 30 : public LayerTreeHostOcclusionTest {
31 public: 31 public:
32 void SetupTree() override { 32 void SetupTree() override {
33 scoped_refptr<Layer> root = Layer::Create(); 33 scoped_refptr<Layer> root = Layer::Create(layer_settings());
34 root->SetBounds(gfx::Size(100, 100)); 34 root->SetBounds(gfx::Size(100, 100));
35 root->SetIsDrawable(true); 35 root->SetIsDrawable(true);
36 36
37 scoped_refptr<Layer> child = Layer::Create(); 37 scoped_refptr<Layer> child = Layer::Create(layer_settings());
38 child->SetBounds(gfx::Size(50, 60)); 38 child->SetBounds(gfx::Size(50, 60));
39 child->SetPosition(gfx::PointF(10.f, 5.5f)); 39 child->SetPosition(gfx::PointF(10.f, 5.5f));
40 child->SetContentsOpaque(true); 40 child->SetContentsOpaque(true);
41 child->SetIsDrawable(true); 41 child->SetIsDrawable(true);
42 root->AddChild(child); 42 root->AddChild(child);
43 43
44 layer_tree_host()->SetRootLayer(root); 44 layer_tree_host()->SetRootLayer(root);
45 LayerTreeTest::SetupTree(); 45 LayerTreeTest::SetupTree();
46 } 46 }
47 47
(...skipping 21 matching lines...) Expand all
69 void AfterTest() override {} 69 void AfterTest() override {}
70 }; 70 };
71 71
72 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestDrawPropertiesOnLayer); 72 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestDrawPropertiesOnLayer);
73 73
74 // Verify occlusion is set on the render surfaces. 74 // Verify occlusion is set on the render surfaces.
75 class LayerTreeHostOcclusionTestDrawPropertiesOnSurface 75 class LayerTreeHostOcclusionTestDrawPropertiesOnSurface
76 : public LayerTreeHostOcclusionTest { 76 : public LayerTreeHostOcclusionTest {
77 public: 77 public:
78 void SetupTree() override { 78 void SetupTree() override {
79 scoped_refptr<Layer> root = Layer::Create(); 79 scoped_refptr<Layer> root = Layer::Create(layer_settings());
80 root->SetBounds(gfx::Size(100, 100)); 80 root->SetBounds(gfx::Size(100, 100));
81 root->SetIsDrawable(true); 81 root->SetIsDrawable(true);
82 82
83 scoped_refptr<Layer> child = Layer::Create(); 83 scoped_refptr<Layer> child = Layer::Create(layer_settings());
84 child->SetBounds(gfx::Size(1, 1)); 84 child->SetBounds(gfx::Size(1, 1));
85 child->SetPosition(gfx::PointF(10.f, 5.5f)); 85 child->SetPosition(gfx::PointF(10.f, 5.5f));
86 child->SetIsDrawable(true); 86 child->SetIsDrawable(true);
87 child->SetForceRenderSurface(true); 87 child->SetForceRenderSurface(true);
88 root->AddChild(child); 88 root->AddChild(child);
89 89
90 scoped_refptr<Layer> child2 = Layer::Create(); 90 scoped_refptr<Layer> child2 = Layer::Create(layer_settings());
91 child2->SetBounds(gfx::Size(10, 12)); 91 child2->SetBounds(gfx::Size(10, 12));
92 child2->SetPosition(gfx::PointF(13.f, 8.5f)); 92 child2->SetPosition(gfx::PointF(13.f, 8.5f));
93 child2->SetContentsOpaque(true); 93 child2->SetContentsOpaque(true);
94 child2->SetIsDrawable(true); 94 child2->SetIsDrawable(true);
95 root->AddChild(child2); 95 root->AddChild(child2);
96 96
97 layer_tree_host()->SetRootLayer(root); 97 layer_tree_host()->SetRootLayer(root);
98 LayerTreeTest::SetupTree(); 98 LayerTreeTest::SetupTree();
99 } 99 }
100 100
(...skipping 20 matching lines...) Expand all
121 }; 121 };
122 122
123 SINGLE_AND_MULTI_THREAD_TEST_F( 123 SINGLE_AND_MULTI_THREAD_TEST_F(
124 LayerTreeHostOcclusionTestDrawPropertiesOnSurface); 124 LayerTreeHostOcclusionTestDrawPropertiesOnSurface);
125 125
126 // Verify occlusion is set on mask layers. 126 // Verify occlusion is set on mask layers.
127 class LayerTreeHostOcclusionTestDrawPropertiesOnMask 127 class LayerTreeHostOcclusionTestDrawPropertiesOnMask
128 : public LayerTreeHostOcclusionTest { 128 : public LayerTreeHostOcclusionTest {
129 public: 129 public:
130 void SetupTree() override { 130 void SetupTree() override {
131 scoped_refptr<Layer> root = Layer::Create(); 131 scoped_refptr<Layer> root = Layer::Create(layer_settings());
132 root->SetBounds(gfx::Size(100, 100)); 132 root->SetBounds(gfx::Size(100, 100));
133 root->SetIsDrawable(true); 133 root->SetIsDrawable(true);
134 134
135 scoped_refptr<Layer> child = Layer::Create(); 135 scoped_refptr<Layer> child = Layer::Create(layer_settings());
136 child->SetBounds(gfx::Size(30, 40)); 136 child->SetBounds(gfx::Size(30, 40));
137 child->SetPosition(gfx::PointF(10.f, 5.5f)); 137 child->SetPosition(gfx::PointF(10.f, 5.5f));
138 child->SetIsDrawable(true); 138 child->SetIsDrawable(true);
139 root->AddChild(child); 139 root->AddChild(child);
140 140
141 scoped_refptr<Layer> make_surface_bigger = Layer::Create(); 141 scoped_refptr<Layer> make_surface_bigger = Layer::Create(layer_settings());
142 make_surface_bigger->SetBounds(gfx::Size(100, 100)); 142 make_surface_bigger->SetBounds(gfx::Size(100, 100));
143 make_surface_bigger->SetPosition(gfx::PointF(-10.f, -15.f)); 143 make_surface_bigger->SetPosition(gfx::PointF(-10.f, -15.f));
144 make_surface_bigger->SetIsDrawable(true); 144 make_surface_bigger->SetIsDrawable(true);
145 child->AddChild(make_surface_bigger); 145 child->AddChild(make_surface_bigger);
146 146
147 scoped_refptr<Layer> mask = PictureLayer::Create(&client_); 147 scoped_refptr<Layer> mask =
148 PictureLayer::Create(layer_settings(), &client_);
148 mask->SetBounds(gfx::Size(30, 40)); 149 mask->SetBounds(gfx::Size(30, 40));
149 mask->SetIsDrawable(true); 150 mask->SetIsDrawable(true);
150 child->SetMaskLayer(mask.get()); 151 child->SetMaskLayer(mask.get());
151 152
152 scoped_refptr<Layer> child2 = Layer::Create(); 153 scoped_refptr<Layer> child2 = Layer::Create(layer_settings());
153 child2->SetBounds(gfx::Size(10, 12)); 154 child2->SetBounds(gfx::Size(10, 12));
154 child2->SetPosition(gfx::PointF(13.f, 8.5f)); 155 child2->SetPosition(gfx::PointF(13.f, 8.5f));
155 child2->SetContentsOpaque(true); 156 child2->SetContentsOpaque(true);
156 child2->SetIsDrawable(true); 157 child2->SetIsDrawable(true);
157 root->AddChild(child2); 158 root->AddChild(child2);
158 159
159 layer_tree_host()->SetRootLayer(root); 160 layer_tree_host()->SetRootLayer(root);
160 LayerTreeTest::SetupTree(); 161 LayerTreeTest::SetupTree();
161 } 162 }
162 163
(...skipping 28 matching lines...) Expand all
191 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestDrawPropertiesOnMask); 192 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestDrawPropertiesOnMask);
192 193
193 // Verify occlusion is set to empty inside the subtree of a replica. This is 194 // Verify occlusion is set to empty inside the subtree of a replica. This is
194 // done because the tile system does not know about replicas, and so would not 195 // done because the tile system does not know about replicas, and so would not
195 // know that something is unoccluded on the replica even though it's occluded on 196 // know that something is unoccluded on the replica even though it's occluded on
196 // the original. 197 // the original.
197 class LayerTreeHostOcclusionTestDrawPropertiesInsideReplica 198 class LayerTreeHostOcclusionTestDrawPropertiesInsideReplica
198 : public LayerTreeHostOcclusionTest { 199 : public LayerTreeHostOcclusionTest {
199 public: 200 public:
200 void SetupTree() override { 201 void SetupTree() override {
201 scoped_refptr<Layer> root = Layer::Create(); 202 scoped_refptr<Layer> root = Layer::Create(layer_settings());
202 root->SetBounds(gfx::Size(100, 100)); 203 root->SetBounds(gfx::Size(100, 100));
203 root->SetIsDrawable(true); 204 root->SetIsDrawable(true);
204 205
205 scoped_refptr<Layer> child = Layer::Create(); 206 scoped_refptr<Layer> child = Layer::Create(layer_settings());
206 child->SetBounds(gfx::Size(1, 1)); 207 child->SetBounds(gfx::Size(1, 1));
207 child->SetPosition(gfx::PointF(10.f, 5.5f)); 208 child->SetPosition(gfx::PointF(10.f, 5.5f));
208 child->SetIsDrawable(true); 209 child->SetIsDrawable(true);
209 child->SetForceRenderSurface(true); 210 child->SetForceRenderSurface(true);
210 root->AddChild(child); 211 root->AddChild(child);
211 212
212 scoped_refptr<Layer> replica = Layer::Create(); 213 scoped_refptr<Layer> replica = Layer::Create(layer_settings());
213 gfx::Transform translate; 214 gfx::Transform translate;
214 translate.Translate(20.f, 4.f); 215 translate.Translate(20.f, 4.f);
215 replica->SetTransform(translate); 216 replica->SetTransform(translate);
216 child->SetReplicaLayer(replica.get()); 217 child->SetReplicaLayer(replica.get());
217 218
218 scoped_refptr<Layer> mask = PictureLayer::Create(&client_); 219 scoped_refptr<Layer> mask =
220 PictureLayer::Create(layer_settings(), &client_);
219 mask->SetBounds(gfx::Size(30, 40)); 221 mask->SetBounds(gfx::Size(30, 40));
220 mask->SetIsDrawable(true); 222 mask->SetIsDrawable(true);
221 child->SetMaskLayer(mask.get()); 223 child->SetMaskLayer(mask.get());
222 224
223 scoped_refptr<Layer> child2 = Layer::Create(); 225 scoped_refptr<Layer> child2 = Layer::Create(layer_settings());
224 child2->SetBounds(gfx::Size(10, 12)); 226 child2->SetBounds(gfx::Size(10, 12));
225 child2->SetPosition(gfx::PointF(13.f, 8.5f)); 227 child2->SetPosition(gfx::PointF(13.f, 8.5f));
226 child2->SetContentsOpaque(true); 228 child2->SetContentsOpaque(true);
227 child2->SetIsDrawable(true); 229 child2->SetIsDrawable(true);
228 root->AddChild(child2); 230 root->AddChild(child2);
229 231
230 layer_tree_host()->SetRootLayer(root); 232 layer_tree_host()->SetRootLayer(root);
231 LayerTreeTest::SetupTree(); 233 LayerTreeTest::SetupTree();
232 } 234 }
233 235
(...skipping 27 matching lines...) Expand all
261 void AfterTest() override {} 263 void AfterTest() override {}
262 264
263 FakeContentLayerClient client_; 265 FakeContentLayerClient client_;
264 }; 266 };
265 267
266 SINGLE_AND_MULTI_THREAD_TEST_F( 268 SINGLE_AND_MULTI_THREAD_TEST_F(
267 LayerTreeHostOcclusionTestDrawPropertiesInsideReplica); 269 LayerTreeHostOcclusionTestDrawPropertiesInsideReplica);
268 270
269 } // namespace 271 } // namespace
270 } // namespace cc 272 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_no_message_loop.cc ('k') | cc/trees/layer_tree_host_unittest_picture.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698