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

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

Issue 1783613004: CC Animation: Erase cc::LayerSettings everywhere. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@eraseandroid
Patch Set: Rebase. Created 4 years, 9 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(layer_settings()); 33 scoped_refptr<Layer> root = Layer::Create();
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(layer_settings()); 37 scoped_refptr<Layer> child = Layer::Create();
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(layer_settings()); 79 scoped_refptr<Layer> root = Layer::Create();
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(layer_settings()); 83 scoped_refptr<Layer> child = Layer::Create();
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(layer_settings()); 90 scoped_refptr<Layer> child2 = Layer::Create();
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(layer_settings()); 131 scoped_refptr<Layer> root = Layer::Create();
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(layer_settings()); 135 scoped_refptr<Layer> child = Layer::Create();
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(layer_settings()); 141 scoped_refptr<Layer> make_surface_bigger = Layer::Create();
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 = 147 scoped_refptr<Layer> mask = PictureLayer::Create(&client_);
148 PictureLayer::Create(layer_settings(), &client_);
149 mask->SetBounds(gfx::Size(30, 40)); 148 mask->SetBounds(gfx::Size(30, 40));
150 mask->SetIsDrawable(true); 149 mask->SetIsDrawable(true);
151 child->SetMaskLayer(mask.get()); 150 child->SetMaskLayer(mask.get());
152 151
153 scoped_refptr<Layer> child2 = Layer::Create(layer_settings()); 152 scoped_refptr<Layer> child2 = Layer::Create();
154 child2->SetBounds(gfx::Size(10, 12)); 153 child2->SetBounds(gfx::Size(10, 12));
155 child2->SetPosition(gfx::PointF(13.f, 8.5f)); 154 child2->SetPosition(gfx::PointF(13.f, 8.5f));
156 child2->SetContentsOpaque(true); 155 child2->SetContentsOpaque(true);
157 child2->SetIsDrawable(true); 156 child2->SetIsDrawable(true);
158 root->AddChild(child2); 157 root->AddChild(child2);
159 158
160 layer_tree_host()->SetRootLayer(root); 159 layer_tree_host()->SetRootLayer(root);
161 LayerTreeTest::SetupTree(); 160 LayerTreeTest::SetupTree();
162 client_.set_bounds(root->bounds()); 161 client_.set_bounds(root->bounds());
163 } 162 }
(...skipping 26 matching lines...) Expand all
190 FakeContentLayerClient client_; 189 FakeContentLayerClient client_;
191 }; 190 };
192 191
193 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestDrawPropertiesOnMask); 192 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestDrawPropertiesOnMask);
194 193
195 // Verify occlusion is correctly set on scaled mask layers. 194 // Verify occlusion is correctly set on scaled mask layers.
196 class LayerTreeHostOcclusionTestDrawPropertiesOnScaledMask 195 class LayerTreeHostOcclusionTestDrawPropertiesOnScaledMask
197 : public LayerTreeHostOcclusionTest { 196 : public LayerTreeHostOcclusionTest {
198 public: 197 public:
199 void SetupTree() override { 198 void SetupTree() override {
200 scoped_refptr<Layer> root = Layer::Create(layer_settings()); 199 scoped_refptr<Layer> root = Layer::Create();
201 root->SetBounds(gfx::Size(100, 100)); 200 root->SetBounds(gfx::Size(100, 100));
202 root->SetIsDrawable(true); 201 root->SetIsDrawable(true);
203 202
204 gfx::Transform scale; 203 gfx::Transform scale;
205 scale.Scale(2, 2); 204 scale.Scale(2, 2);
206 205
207 scoped_refptr<Layer> child = Layer::Create(layer_settings()); 206 scoped_refptr<Layer> child = Layer::Create();
208 child->SetBounds(gfx::Size(30, 40)); 207 child->SetBounds(gfx::Size(30, 40));
209 child->SetTransform(scale); 208 child->SetTransform(scale);
210 root->AddChild(child); 209 root->AddChild(child);
211 210
212 scoped_refptr<Layer> grand_child = Layer::Create(layer_settings()); 211 scoped_refptr<Layer> grand_child = Layer::Create();
213 grand_child->SetBounds(gfx::Size(100, 100)); 212 grand_child->SetBounds(gfx::Size(100, 100));
214 grand_child->SetPosition(gfx::PointF(-10.f, -15.f)); 213 grand_child->SetPosition(gfx::PointF(-10.f, -15.f));
215 grand_child->SetIsDrawable(true); 214 grand_child->SetIsDrawable(true);
216 child->AddChild(grand_child); 215 child->AddChild(grand_child);
217 216
218 scoped_refptr<Layer> mask = 217 scoped_refptr<Layer> mask = PictureLayer::Create(&client_);
219 PictureLayer::Create(layer_settings(), &client_);
220 mask->SetBounds(gfx::Size(30, 40)); 218 mask->SetBounds(gfx::Size(30, 40));
221 mask->SetIsDrawable(true); 219 mask->SetIsDrawable(true);
222 child->SetMaskLayer(mask.get()); 220 child->SetMaskLayer(mask.get());
223 221
224 scoped_refptr<Layer> child2 = Layer::Create(layer_settings()); 222 scoped_refptr<Layer> child2 = Layer::Create();
225 child2->SetBounds(gfx::Size(10, 11)); 223 child2->SetBounds(gfx::Size(10, 11));
226 child2->SetPosition(gfx::PointF(13.f, 15.f)); 224 child2->SetPosition(gfx::PointF(13.f, 15.f));
227 child2->SetContentsOpaque(true); 225 child2->SetContentsOpaque(true);
228 child2->SetIsDrawable(true); 226 child2->SetIsDrawable(true);
229 root->AddChild(child2); 227 root->AddChild(child2);
230 228
231 layer_tree_host()->SetRootLayer(root); 229 layer_tree_host()->SetRootLayer(root);
232 LayerTreeTest::SetupTree(); 230 LayerTreeTest::SetupTree();
233 client_.set_bounds(root->bounds()); 231 client_.set_bounds(root->bounds());
234 } 232 }
(...skipping 24 matching lines...) Expand all
259 LayerTreeHostOcclusionTestDrawPropertiesOnScaledMask); 257 LayerTreeHostOcclusionTestDrawPropertiesOnScaledMask);
260 258
261 // Verify occlusion is set to empty inside the subtree of a replica. This is 259 // Verify occlusion is set to empty inside the subtree of a replica. This is
262 // done because the tile system does not know about replicas, and so would not 260 // done because the tile system does not know about replicas, and so would not
263 // know that something is unoccluded on the replica even though it's occluded on 261 // know that something is unoccluded on the replica even though it's occluded on
264 // the original. 262 // the original.
265 class LayerTreeHostOcclusionTestDrawPropertiesInsideReplica 263 class LayerTreeHostOcclusionTestDrawPropertiesInsideReplica
266 : public LayerTreeHostOcclusionTest { 264 : public LayerTreeHostOcclusionTest {
267 public: 265 public:
268 void SetupTree() override { 266 void SetupTree() override {
269 scoped_refptr<Layer> root = Layer::Create(layer_settings()); 267 scoped_refptr<Layer> root = Layer::Create();
270 root->SetBounds(gfx::Size(100, 100)); 268 root->SetBounds(gfx::Size(100, 100));
271 root->SetIsDrawable(true); 269 root->SetIsDrawable(true);
272 270
273 scoped_refptr<Layer> child = Layer::Create(layer_settings()); 271 scoped_refptr<Layer> child = Layer::Create();
274 child->SetBounds(gfx::Size(1, 1)); 272 child->SetBounds(gfx::Size(1, 1));
275 child->SetPosition(gfx::PointF(10.f, 5.5f)); 273 child->SetPosition(gfx::PointF(10.f, 5.5f));
276 child->SetIsDrawable(true); 274 child->SetIsDrawable(true);
277 child->SetForceRenderSurface(true); 275 child->SetForceRenderSurface(true);
278 root->AddChild(child); 276 root->AddChild(child);
279 277
280 scoped_refptr<Layer> replica = Layer::Create(layer_settings()); 278 scoped_refptr<Layer> replica = Layer::Create();
281 gfx::Transform translate; 279 gfx::Transform translate;
282 translate.Translate(20.f, 4.f); 280 translate.Translate(20.f, 4.f);
283 replica->SetTransform(translate); 281 replica->SetTransform(translate);
284 child->SetReplicaLayer(replica.get()); 282 child->SetReplicaLayer(replica.get());
285 283
286 scoped_refptr<Layer> mask = 284 scoped_refptr<Layer> mask = PictureLayer::Create(&client_);
287 PictureLayer::Create(layer_settings(), &client_);
288 mask->SetBounds(gfx::Size(30, 40)); 285 mask->SetBounds(gfx::Size(30, 40));
289 mask->SetIsDrawable(true); 286 mask->SetIsDrawable(true);
290 child->SetMaskLayer(mask.get()); 287 child->SetMaskLayer(mask.get());
291 288
292 scoped_refptr<Layer> child2 = Layer::Create(layer_settings()); 289 scoped_refptr<Layer> child2 = Layer::Create();
293 child2->SetBounds(gfx::Size(10, 12)); 290 child2->SetBounds(gfx::Size(10, 12));
294 child2->SetPosition(gfx::PointF(13.f, 8.5f)); 291 child2->SetPosition(gfx::PointF(13.f, 8.5f));
295 child2->SetContentsOpaque(true); 292 child2->SetContentsOpaque(true);
296 child2->SetIsDrawable(true); 293 child2->SetIsDrawable(true);
297 root->AddChild(child2); 294 root->AddChild(child2);
298 295
299 layer_tree_host()->SetRootLayer(root); 296 layer_tree_host()->SetRootLayer(root);
300 LayerTreeTest::SetupTree(); 297 LayerTreeTest::SetupTree();
301 client_.set_bounds(root->bounds()); 298 client_.set_bounds(root->bounds());
302 } 299 }
(...skipping 28 matching lines...) Expand all
331 void AfterTest() override {} 328 void AfterTest() override {}
332 329
333 FakeContentLayerClient client_; 330 FakeContentLayerClient client_;
334 }; 331 };
335 332
336 SINGLE_AND_MULTI_THREAD_TEST_F( 333 SINGLE_AND_MULTI_THREAD_TEST_F(
337 LayerTreeHostOcclusionTestDrawPropertiesInsideReplica); 334 LayerTreeHostOcclusionTestDrawPropertiesInsideReplica);
338 335
339 } // namespace 336 } // namespace
340 } // namespace cc 337 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698