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

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

Issue 640203002: [C++11 Allowed Features] Declares a type-safe null pointer converting from NULL to nullptr [part-… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/output/copy_output_request.h" 8 #include "cc/output/copy_output_request.h"
9 #include "cc/output/copy_output_result.h" 9 #include "cc/output/copy_output_result.h"
10 #include "cc/test/layer_tree_test.h" 10 #include "cc/test/layer_tree_test.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 }; 113 };
114 114
115 115
116 class LayerTreeHostOcclusionTestOcclusionSurfaceClipping 116 class LayerTreeHostOcclusionTestOcclusionSurfaceClipping
117 : public LayerTreeHostOcclusionTest { 117 : public LayerTreeHostOcclusionTest {
118 public: 118 public:
119 virtual void SetupTree() override { 119 virtual void SetupTree() override {
120 // The child layer is a surface and the grand_child is opaque, but clipped 120 // The child layer is a surface and the grand_child is opaque, but clipped
121 // to the child and root 121 // to the child and root
122 SetLayerPropertiesForTesting( 122 SetLayerPropertiesForTesting(
123 root_.get(), NULL, identity_matrix_, 123 root_.get(), nullptr, identity_matrix_,
124 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); 124 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true);
125 SetLayerPropertiesForTesting( 125 SetLayerPropertiesForTesting(
126 child_.get(), root_.get(), identity_matrix_, 126 child_.get(), root_.get(), identity_matrix_,
127 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), false); 127 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), false);
128 SetLayerPropertiesForTesting( 128 SetLayerPropertiesForTesting(
129 grand_child_.get(), child_.get(), identity_matrix_, 129 grand_child_.get(), child_.get(), identity_matrix_,
130 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); 130 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true);
131 131
132 child_->SetMasksToBounds(true); 132 child_->SetMasksToBounds(true);
133 child_->SetForceRenderSurface(true); 133 child_->SetForceRenderSurface(true);
134 134
135 child_->set_expected_occlusion(gfx::Rect(0, 0, 10, 190)); 135 child_->set_expected_occlusion(gfx::Rect(0, 0, 10, 190));
136 root_->set_expected_occlusion(gfx::Rect(10, 10, 10, 190)); 136 root_->set_expected_occlusion(gfx::Rect(10, 10, 10, 190));
137 137
138 layer_tree_host()->SetRootLayer(root_); 138 layer_tree_host()->SetRootLayer(root_);
139 LayerTreeTest::SetupTree(); 139 LayerTreeTest::SetupTree();
140 } 140 }
141 }; 141 };
142 142
143 SINGLE_AND_MULTI_THREAD_TEST_F( 143 SINGLE_AND_MULTI_THREAD_TEST_F(
144 LayerTreeHostOcclusionTestOcclusionSurfaceClipping); 144 LayerTreeHostOcclusionTestOcclusionSurfaceClipping);
145 145
146 class LayerTreeHostOcclusionTestOcclusionSurfaceClippingOpaque 146 class LayerTreeHostOcclusionTestOcclusionSurfaceClippingOpaque
147 : public LayerTreeHostOcclusionTest { 147 : public LayerTreeHostOcclusionTest {
148 public: 148 public:
149 virtual void SetupTree() override { 149 virtual void SetupTree() override {
150 // If the child layer is opaque, then it adds to the occlusion seen by the 150 // If the child layer is opaque, then it adds to the occlusion seen by the
151 // root_. 151 // root_.
152 SetLayerPropertiesForTesting( 152 SetLayerPropertiesForTesting(
153 root_.get(), NULL, identity_matrix_, 153 root_.get(), nullptr, identity_matrix_,
154 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); 154 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true);
155 SetLayerPropertiesForTesting( 155 SetLayerPropertiesForTesting(
156 child_.get(), root_.get(), identity_matrix_, 156 child_.get(), root_.get(), identity_matrix_,
157 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); 157 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true);
158 SetLayerPropertiesForTesting( 158 SetLayerPropertiesForTesting(
159 grand_child_.get(), child_.get(), identity_matrix_, 159 grand_child_.get(), child_.get(), identity_matrix_,
160 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); 160 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true);
161 161
162 child_->SetMasksToBounds(true); 162 child_->SetMasksToBounds(true);
163 child_->SetForceRenderSurface(true); 163 child_->SetForceRenderSurface(true);
164 164
165 child_->set_expected_occlusion(gfx::Rect(0, 0, 10, 190)); 165 child_->set_expected_occlusion(gfx::Rect(0, 0, 10, 190));
166 root_->set_expected_occlusion(gfx::Rect(10, 10, 190, 190)); 166 root_->set_expected_occlusion(gfx::Rect(10, 10, 190, 190));
167 167
168 layer_tree_host()->SetRootLayer(root_); 168 layer_tree_host()->SetRootLayer(root_);
169 LayerTreeTest::SetupTree(); 169 LayerTreeTest::SetupTree();
170 } 170 }
171 }; 171 };
172 172
173 SINGLE_AND_MULTI_THREAD_TEST_F( 173 SINGLE_AND_MULTI_THREAD_TEST_F(
174 LayerTreeHostOcclusionTestOcclusionSurfaceClippingOpaque); 174 LayerTreeHostOcclusionTestOcclusionSurfaceClippingOpaque);
175 175
176 class LayerTreeHostOcclusionTestOcclusionTwoChildren 176 class LayerTreeHostOcclusionTestOcclusionTwoChildren
177 : public LayerTreeHostOcclusionTest { 177 : public LayerTreeHostOcclusionTest {
178 public: 178 public:
179 virtual void SetupTree() override { 179 virtual void SetupTree() override {
180 // Add a second child to the root layer and the regions should merge 180 // Add a second child to the root layer and the regions should merge
181 SetLayerPropertiesForTesting( 181 SetLayerPropertiesForTesting(
182 root_.get(), NULL, identity_matrix_, 182 root_.get(), nullptr, identity_matrix_,
183 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); 183 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true);
184 SetLayerPropertiesForTesting( 184 SetLayerPropertiesForTesting(
185 child_.get(), root_.get(), identity_matrix_, 185 child_.get(), root_.get(), identity_matrix_,
186 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), false); 186 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), false);
187 SetLayerPropertiesForTesting( 187 SetLayerPropertiesForTesting(
188 grand_child_.get(), child_.get(), identity_matrix_, 188 grand_child_.get(), child_.get(), identity_matrix_,
189 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); 189 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true);
190 SetLayerPropertiesForTesting( 190 SetLayerPropertiesForTesting(
191 child2_.get(), root_.get(), identity_matrix_, 191 child2_.get(), root_.get(), identity_matrix_,
192 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true); 192 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true);
(...skipping 13 matching lines...) Expand all
206 SINGLE_AND_MULTI_THREAD_TEST_F( 206 SINGLE_AND_MULTI_THREAD_TEST_F(
207 LayerTreeHostOcclusionTestOcclusionTwoChildren); 207 LayerTreeHostOcclusionTestOcclusionTwoChildren);
208 208
209 class LayerTreeHostOcclusionTestOcclusionMask 209 class LayerTreeHostOcclusionTestOcclusionMask
210 : public LayerTreeHostOcclusionTest { 210 : public LayerTreeHostOcclusionTest {
211 public: 211 public:
212 virtual void SetupTree() override { 212 virtual void SetupTree() override {
213 // If the child layer has a mask on it, then it shouldn't contribute to 213 // If the child layer has a mask on it, then it shouldn't contribute to
214 // occlusion on stuff below it. 214 // occlusion on stuff below it.
215 SetLayerPropertiesForTesting( 215 SetLayerPropertiesForTesting(
216 root_.get(), NULL, identity_matrix_, 216 root_.get(), nullptr, identity_matrix_,
217 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); 217 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true);
218 SetLayerPropertiesForTesting( 218 SetLayerPropertiesForTesting(
219 child2_.get(), root_.get(), identity_matrix_, 219 child2_.get(), root_.get(), identity_matrix_,
220 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); 220 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true);
221 SetLayerPropertiesForTesting( 221 SetLayerPropertiesForTesting(
222 child_.get(), root_.get(), identity_matrix_, 222 child_.get(), root_.get(), identity_matrix_,
223 gfx::PointF(20.f, 20.f), gfx::Size(500, 500), true); 223 gfx::PointF(20.f, 20.f), gfx::Size(500, 500), true);
224 SetLayerPropertiesForTesting( 224 SetLayerPropertiesForTesting(
225 grand_child_.get(), child_.get(), identity_matrix_, 225 grand_child_.get(), child_.get(), identity_matrix_,
226 gfx::PointF(-10.f, -10.f), gfx::Size(500, 500), true); 226 gfx::PointF(-10.f, -10.f), gfx::Size(500, 500), true);
(...skipping 13 matching lines...) Expand all
240 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionMask); 240 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionMask);
241 241
242 class LayerTreeHostOcclusionTestOcclusionMaskBelowOcclusion 242 class LayerTreeHostOcclusionTestOcclusionMaskBelowOcclusion
243 : public LayerTreeHostOcclusionTest { 243 : public LayerTreeHostOcclusionTest {
244 public: 244 public:
245 virtual void SetupTree() override { 245 virtual void SetupTree() override {
246 // If the child layer with a mask is below child2, then child2 should 246 // If the child layer with a mask is below child2, then child2 should
247 // contribute to occlusion on everything, and child shouldn't contribute 247 // contribute to occlusion on everything, and child shouldn't contribute
248 // to the root_. 248 // to the root_.
249 SetLayerPropertiesForTesting( 249 SetLayerPropertiesForTesting(
250 root_.get(), NULL, identity_matrix_, 250 root_.get(), nullptr, identity_matrix_,
251 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); 251 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true);
252 SetLayerPropertiesForTesting( 252 SetLayerPropertiesForTesting(
253 child_.get(), root_.get(), identity_matrix_, 253 child_.get(), root_.get(), identity_matrix_,
254 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); 254 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true);
255 SetLayerPropertiesForTesting( 255 SetLayerPropertiesForTesting(
256 grand_child_.get(), child_.get(), identity_matrix_, 256 grand_child_.get(), child_.get(), identity_matrix_,
257 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); 257 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true);
258 SetLayerPropertiesForTesting( 258 SetLayerPropertiesForTesting(
259 child2_.get(), root_.get(), identity_matrix_, 259 child2_.get(), root_.get(), identity_matrix_,
260 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true); 260 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true);
(...skipping 14 matching lines...) Expand all
275 SINGLE_AND_MULTI_THREAD_TEST_F( 275 SINGLE_AND_MULTI_THREAD_TEST_F(
276 LayerTreeHostOcclusionTestOcclusionMaskBelowOcclusion); 276 LayerTreeHostOcclusionTestOcclusionMaskBelowOcclusion);
277 277
278 class LayerTreeHostOcclusionTestOcclusionOpacity 278 class LayerTreeHostOcclusionTestOcclusionOpacity
279 : public LayerTreeHostOcclusionTest { 279 : public LayerTreeHostOcclusionTest {
280 public: 280 public:
281 virtual void SetupTree() override { 281 virtual void SetupTree() override {
282 // If the child layer has a non-opaque opacity, then it shouldn't 282 // If the child layer has a non-opaque opacity, then it shouldn't
283 // contribute to occlusion on stuff below it 283 // contribute to occlusion on stuff below it
284 SetLayerPropertiesForTesting( 284 SetLayerPropertiesForTesting(
285 root_.get(), NULL, identity_matrix_, 285 root_.get(), nullptr, identity_matrix_,
286 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); 286 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true);
287 SetLayerPropertiesForTesting( 287 SetLayerPropertiesForTesting(
288 child2_.get(), root_.get(), identity_matrix_, 288 child2_.get(), root_.get(), identity_matrix_,
289 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true); 289 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true);
290 SetLayerPropertiesForTesting( 290 SetLayerPropertiesForTesting(
291 child_.get(), root_.get(), identity_matrix_, 291 child_.get(), root_.get(), identity_matrix_,
292 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); 292 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true);
293 SetLayerPropertiesForTesting( 293 SetLayerPropertiesForTesting(
294 grand_child_.get(), child_.get(), identity_matrix_, 294 grand_child_.get(), child_.get(), identity_matrix_,
295 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); 295 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true);
(...skipping 13 matching lines...) Expand all
309 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionOpacity); 309 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionOpacity);
310 310
311 class LayerTreeHostOcclusionTestOcclusionOpacityBelowOcclusion 311 class LayerTreeHostOcclusionTestOcclusionOpacityBelowOcclusion
312 : public LayerTreeHostOcclusionTest { 312 : public LayerTreeHostOcclusionTest {
313 public: 313 public:
314 virtual void SetupTree() override { 314 virtual void SetupTree() override {
315 // If the child layer with non-opaque opacity is below child2, then 315 // If the child layer with non-opaque opacity is below child2, then
316 // child2 should contribute to occlusion on everything, and child shouldn't 316 // child2 should contribute to occlusion on everything, and child shouldn't
317 // contribute to the root_. 317 // contribute to the root_.
318 SetLayerPropertiesForTesting( 318 SetLayerPropertiesForTesting(
319 root_.get(), NULL, identity_matrix_, 319 root_.get(), nullptr, identity_matrix_,
320 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); 320 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true);
321 SetLayerPropertiesForTesting( 321 SetLayerPropertiesForTesting(
322 child_.get(), root_.get(), identity_matrix_, 322 child_.get(), root_.get(), identity_matrix_,
323 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); 323 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true);
324 SetLayerPropertiesForTesting( 324 SetLayerPropertiesForTesting(
325 grand_child_.get(), child_.get(), identity_matrix_, 325 grand_child_.get(), child_.get(), identity_matrix_,
326 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); 326 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true);
327 SetLayerPropertiesForTesting( 327 SetLayerPropertiesForTesting(
328 child2_.get(), root_.get(), identity_matrix_, 328 child2_.get(), root_.get(), identity_matrix_,
329 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true); 329 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true);
(...skipping 14 matching lines...) Expand all
344 SINGLE_AND_MULTI_THREAD_TEST_F( 344 SINGLE_AND_MULTI_THREAD_TEST_F(
345 LayerTreeHostOcclusionTestOcclusionOpacityBelowOcclusion); 345 LayerTreeHostOcclusionTestOcclusionOpacityBelowOcclusion);
346 346
347 class LayerTreeHostOcclusionTestOcclusionBlending 347 class LayerTreeHostOcclusionTestOcclusionBlending
348 : public LayerTreeHostOcclusionTest { 348 : public LayerTreeHostOcclusionTest {
349 public: 349 public:
350 virtual void SetupTree() override { 350 virtual void SetupTree() override {
351 // If the child layer has a blend mode, then it shouldn't 351 // If the child layer has a blend mode, then it shouldn't
352 // contribute to occlusion on stuff below it 352 // contribute to occlusion on stuff below it
353 SetLayerPropertiesForTesting( 353 SetLayerPropertiesForTesting(
354 root_.get(), NULL, identity_matrix_, 354 root_.get(), nullptr, identity_matrix_,
355 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); 355 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true);
356 SetLayerPropertiesForTesting( 356 SetLayerPropertiesForTesting(
357 child2_.get(), root_.get(), identity_matrix_, 357 child2_.get(), root_.get(), identity_matrix_,
358 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true); 358 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true);
359 SetLayerPropertiesForTesting( 359 SetLayerPropertiesForTesting(
360 child_.get(), root_.get(), identity_matrix_, 360 child_.get(), root_.get(), identity_matrix_,
361 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); 361 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true);
362 SetLayerPropertiesForTesting( 362 SetLayerPropertiesForTesting(
363 grand_child_.get(), child_.get(), identity_matrix_, 363 grand_child_.get(), child_.get(), identity_matrix_,
364 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); 364 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true);
(...skipping 13 matching lines...) Expand all
378 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionBlending); 378 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionBlending);
379 379
380 class LayerTreeHostOcclusionTestOcclusionBlendingBelowOcclusion 380 class LayerTreeHostOcclusionTestOcclusionBlendingBelowOcclusion
381 : public LayerTreeHostOcclusionTest { 381 : public LayerTreeHostOcclusionTest {
382 public: 382 public:
383 virtual void SetupTree() override { 383 virtual void SetupTree() override {
384 // If the child layer with a blend mode is below child2, then 384 // If the child layer with a blend mode is below child2, then
385 // child2 should contribute to occlusion on everything, and child shouldn't 385 // child2 should contribute to occlusion on everything, and child shouldn't
386 // contribute to the root_. 386 // contribute to the root_.
387 SetLayerPropertiesForTesting( 387 SetLayerPropertiesForTesting(
388 root_.get(), NULL, identity_matrix_, 388 root_.get(), nullptr, identity_matrix_,
389 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); 389 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true);
390 SetLayerPropertiesForTesting( 390 SetLayerPropertiesForTesting(
391 child_.get(), root_.get(), identity_matrix_, 391 child_.get(), root_.get(), identity_matrix_,
392 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); 392 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true);
393 SetLayerPropertiesForTesting( 393 SetLayerPropertiesForTesting(
394 grand_child_.get(), child_.get(), identity_matrix_, 394 grand_child_.get(), child_.get(), identity_matrix_,
395 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); 395 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true);
396 SetLayerPropertiesForTesting( 396 SetLayerPropertiesForTesting(
397 child2_.get(), root_.get(), identity_matrix_, 397 child2_.get(), root_.get(), identity_matrix_,
398 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true); 398 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true);
(...skipping 17 matching lines...) Expand all
416 : public LayerTreeHostOcclusionTest { 416 : public LayerTreeHostOcclusionTest {
417 public: 417 public:
418 virtual void SetupTree() override { 418 virtual void SetupTree() override {
419 FilterOperations filters; 419 FilterOperations filters;
420 filters.Append(FilterOperation::CreateOpacityFilter(0.5f)); 420 filters.Append(FilterOperation::CreateOpacityFilter(0.5f));
421 421
422 // If the child layer has a filter that changes alpha values, and is below 422 // If the child layer has a filter that changes alpha values, and is below
423 // child2, then child2 should contribute to occlusion on everything, 423 // child2, then child2 should contribute to occlusion on everything,
424 // and child shouldn't contribute to the root 424 // and child shouldn't contribute to the root
425 SetLayerPropertiesForTesting( 425 SetLayerPropertiesForTesting(
426 root_.get(), NULL, identity_matrix_, 426 root_.get(), nullptr, identity_matrix_,
427 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); 427 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true);
428 SetLayerPropertiesForTesting(child_.get(), 428 SetLayerPropertiesForTesting(child_.get(),
429 root_.get(), 429 root_.get(),
430 identity_matrix_, 430 identity_matrix_,
431 gfx::PointF(0.f, 0.f), 431 gfx::PointF(0.f, 0.f),
432 gfx::Size(500, 500), 432 gfx::Size(500, 500),
433 true); 433 true);
434 SetLayerPropertiesForTesting(grand_child_.get(), 434 SetLayerPropertiesForTesting(grand_child_.get(),
435 child_.get(), 435 child_.get(),
436 identity_matrix_, 436 identity_matrix_,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 child_transform.Rotate(90.0); 473 child_transform.Rotate(90.0);
474 child_transform.Translate(-250.0, -250.0); 474 child_transform.Translate(-250.0, -250.0);
475 475
476 FilterOperations filters; 476 FilterOperations filters;
477 filters.Append(FilterOperation::CreateBlurFilter(10.f)); 477 filters.Append(FilterOperation::CreateBlurFilter(10.f));
478 478
479 // If the child layer has a filter that moves pixels/changes alpha, and is 479 // If the child layer has a filter that moves pixels/changes alpha, and is
480 // below child2, then child should not inherit occlusion from outside its 480 // below child2, then child should not inherit occlusion from outside its
481 // subtree, and should not contribute to the root 481 // subtree, and should not contribute to the root
482 SetLayerPropertiesForTesting( 482 SetLayerPropertiesForTesting(
483 root_.get(), NULL, identity_matrix_, 483 root_.get(), nullptr, identity_matrix_,
484 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); 484 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true);
485 SetLayerPropertiesForTesting( 485 SetLayerPropertiesForTesting(
486 child_.get(), root_.get(), child_transform, 486 child_.get(), root_.get(), child_transform,
487 gfx::PointF(30.f, 30.f), gfx::Size(500, 500), true); 487 gfx::PointF(30.f, 30.f), gfx::Size(500, 500), true);
488 SetLayerPropertiesForTesting( 488 SetLayerPropertiesForTesting(
489 grand_child_.get(), child_.get(), identity_matrix_, 489 grand_child_.get(), child_.get(), identity_matrix_,
490 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); 490 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true);
491 SetLayerPropertiesForTesting( 491 SetLayerPropertiesForTesting(
492 child2_.get(), root_.get(), identity_matrix_, 492 child2_.get(), root_.get(), identity_matrix_,
493 gfx::PointF(10.f, 70.f), gfx::Size(500, 500), true); 493 gfx::PointF(10.f, 70.f), gfx::Size(500, 500), true);
(...skipping 16 matching lines...) Expand all
510 : public LayerTreeHostOcclusionTest { 510 : public LayerTreeHostOcclusionTest {
511 public: 511 public:
512 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} 512 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {}
513 513
514 virtual void SetupTree() override { 514 virtual void SetupTree() override {
515 // If the child layer has copy request, and is below child2, 515 // If the child layer has copy request, and is below child2,
516 // then child should not inherit occlusion from outside its subtree. 516 // then child should not inherit occlusion from outside its subtree.
517 // The child layer will still receive occlusion from inside, and 517 // The child layer will still receive occlusion from inside, and
518 // the root layer will recive occlusion from child. 518 // the root layer will recive occlusion from child.
519 SetLayerPropertiesForTesting( 519 SetLayerPropertiesForTesting(
520 root_.get(), NULL, identity_matrix_, 520 root_.get(), nullptr, identity_matrix_,
521 gfx::PointF(), gfx::Size(100, 100), true); 521 gfx::PointF(), gfx::Size(100, 100), true);
522 SetLayerPropertiesForTesting( 522 SetLayerPropertiesForTesting(
523 child_.get(), root_.get(), identity_matrix_, 523 child_.get(), root_.get(), identity_matrix_,
524 gfx::PointF(), gfx::Size(75, 75), true); 524 gfx::PointF(), gfx::Size(75, 75), true);
525 SetLayerPropertiesForTesting( 525 SetLayerPropertiesForTesting(
526 grand_child_.get(), child_.get(), identity_matrix_, 526 grand_child_.get(), child_.get(), identity_matrix_,
527 gfx::PointF(), gfx::Size(75, 50), true); 527 gfx::PointF(), gfx::Size(75, 50), true);
528 SetLayerPropertiesForTesting( 528 SetLayerPropertiesForTesting(
529 child2_.get(), root_.get(), identity_matrix_, 529 child2_.get(), root_.get(), identity_matrix_,
530 gfx::PointF(0.f, 25.f), gfx::Size(75, 75), true); 530 gfx::PointF(0.f, 25.f), gfx::Size(75, 75), true);
(...skipping 14 matching lines...) Expand all
545 545
546 class LayerTreeHostOcclusionTestOcclusionReplica 546 class LayerTreeHostOcclusionTestOcclusionReplica
547 : public LayerTreeHostOcclusionTest { 547 : public LayerTreeHostOcclusionTest {
548 public: 548 public:
549 virtual void SetupTree() override { 549 virtual void SetupTree() override {
550 // If the child layer has copy request, and is below child2, 550 // If the child layer has copy request, and is below child2,
551 // then child should not inherit occlusion from outside its subtree. 551 // then child should not inherit occlusion from outside its subtree.
552 // The child layer will still receive occlusion from inside, and 552 // The child layer will still receive occlusion from inside, and
553 // the root layer will recive occlusion from child. 553 // the root layer will recive occlusion from child.
554 SetLayerPropertiesForTesting( 554 SetLayerPropertiesForTesting(
555 root_.get(), NULL, identity_matrix_, 555 root_.get(), nullptr, identity_matrix_,
556 gfx::PointF(), gfx::Size(100, 100), true); 556 gfx::PointF(), gfx::Size(100, 100), true);
557 SetLayerPropertiesForTesting( 557 SetLayerPropertiesForTesting(
558 child_.get(), root_.get(), identity_matrix_, 558 child_.get(), root_.get(), identity_matrix_,
559 gfx::PointF(), gfx::Size(75, 75), true); 559 gfx::PointF(), gfx::Size(75, 75), true);
560 SetLayerPropertiesForTesting( 560 SetLayerPropertiesForTesting(
561 grand_child_.get(), child_.get(), identity_matrix_, 561 grand_child_.get(), child_.get(), identity_matrix_,
562 gfx::PointF(), gfx::Size(75, 50), true); 562 gfx::PointF(), gfx::Size(75, 50), true);
563 SetLayerPropertiesForTesting( 563 SetLayerPropertiesForTesting(
564 child2_.get(), root_.get(), identity_matrix_, 564 child2_.get(), root_.get(), identity_matrix_,
565 gfx::PointF(0.f, 25.f), gfx::Size(75, 75), true); 565 gfx::PointF(0.f, 25.f), gfx::Size(75, 75), true);
(...skipping 20 matching lines...) Expand all
586 // while computing occlusion. 586 // while computing occlusion.
587 std::vector<scoped_refptr<TestLayer> > layers; 587 std::vector<scoped_refptr<TestLayer> > layers;
588 int num_surfaces = 200; 588 int num_surfaces = 200;
589 int root_width = 400; 589 int root_width = 400;
590 int root_height = 400; 590 int root_height = 400;
591 591
592 for (int i = 0; i < num_surfaces; ++i) { 592 for (int i = 0; i < num_surfaces; ++i) {
593 layers.push_back(TestLayer::Create()); 593 layers.push_back(TestLayer::Create());
594 if (i == 0) { 594 if (i == 0) {
595 SetLayerPropertiesForTesting( 595 SetLayerPropertiesForTesting(
596 layers.back().get(), NULL, identity_matrix_, 596 layers.back().get(), nullptr, identity_matrix_,
597 gfx::PointF(0.f, 0.f), 597 gfx::PointF(0.f, 0.f),
598 gfx::Size(root_width, root_height), true); 598 gfx::Size(root_width, root_height), true);
599 } else { 599 } else {
600 SetLayerPropertiesForTesting( 600 SetLayerPropertiesForTesting(
601 layers.back().get(), layers[layers.size() - 2].get(), 601 layers.back().get(), layers[layers.size() - 2].get(),
602 identity_matrix_, 602 identity_matrix_,
603 gfx::PointF(1.f, 1.f), 603 gfx::PointF(1.f, 1.f),
604 gfx::Size(root_width-i, root_height-i), true); 604 gfx::Size(root_width-i, root_height-i), true);
605 layers.back()->SetForceRenderSurface(true); 605 layers.back()->SetForceRenderSurface(true);
606 } 606 }
(...skipping 13 matching lines...) Expand all
620 620
621 layer_tree_host()->SetRootLayer(layers[0]); 621 layer_tree_host()->SetRootLayer(layers[0]);
622 LayerTreeTest::SetupTree(); 622 LayerTreeTest::SetupTree();
623 } 623 }
624 }; 624 };
625 625
626 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestManySurfaces); 626 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestManySurfaces);
627 627
628 } // namespace 628 } // namespace
629 } // namespace cc 629 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698