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

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

Issue 23455060: mix-blend-mode implementation for accelerated layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unittests fixed Created 7 years 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 | « cc/trees/layer_tree_host_pixeltest_blending.cc ('k') | cc/trees/occlusion_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 root_->set_expected_occlusion(gfx::Rect(20, 10, 10, 190)); 339 root_->set_expected_occlusion(gfx::Rect(20, 10, 10, 190));
340 340
341 layer_tree_host()->SetRootLayer(root_); 341 layer_tree_host()->SetRootLayer(root_);
342 LayerTreeTest::SetupTree(); 342 LayerTreeTest::SetupTree();
343 } 343 }
344 }; 344 };
345 345
346 SINGLE_AND_MULTI_THREAD_TEST_F( 346 SINGLE_AND_MULTI_THREAD_TEST_F(
347 LayerTreeHostOcclusionTestOcclusionOpacityBelowOcclusion); 347 LayerTreeHostOcclusionTestOcclusionOpacityBelowOcclusion);
348 348
349 class LayerTreeHostOcclusionTestOcclusionBlending
350 : public LayerTreeHostOcclusionTest {
351 public:
352 virtual void SetupTree() OVERRIDE {
353 // If the child layer has a blend mode, then it shouldn't
354 // contribute to occlusion on stuff below it
355 SetLayerPropertiesForTesting(
356 root_.get(), NULL, identity_matrix_,
357 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true);
358 SetLayerPropertiesForTesting(
359 child2_.get(), root_.get(), identity_matrix_,
360 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true);
361 SetLayerPropertiesForTesting(
362 child_.get(), root_.get(), identity_matrix_,
363 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true);
364 SetLayerPropertiesForTesting(
365 grand_child_.get(), child_.get(), identity_matrix_,
366 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true);
367
368 child_->SetMasksToBounds(true);
369 child_->SetBlendMode(SkXfermode::kMultiply_Mode);
370 child_->SetForceRenderSurface(true);
371
372 child_->set_expected_occlusion(gfx::Rect(0, 0, 10, 190));
373 root_->set_expected_occlusion(gfx::Rect(20, 10, 10, 190));
374
375 layer_tree_host()->SetRootLayer(root_);
376 LayerTreeTest::SetupTree();
377 }
378 };
379
380 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionBlending);
381
382 class LayerTreeHostOcclusionTestOcclusionBlendingBelowOcclusion
383 : public LayerTreeHostOcclusionTest {
384 public:
385 virtual void SetupTree() OVERRIDE {
386 // If the child layer with a blend mode is below child2, then
387 // child2 should contribute to occlusion on everything, and child shouldn't
388 // contribute to the root_.
389 SetLayerPropertiesForTesting(
390 root_.get(), NULL, identity_matrix_,
391 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true);
392 SetLayerPropertiesForTesting(
393 child_.get(), root_.get(), identity_matrix_,
394 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true);
395 SetLayerPropertiesForTesting(
396 grand_child_.get(), child_.get(), identity_matrix_,
397 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true);
398 SetLayerPropertiesForTesting(
399 child2_.get(), root_.get(), identity_matrix_,
400 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true);
401
402 child_->SetMasksToBounds(true);
403 child_->SetBlendMode(SkXfermode::kMultiply_Mode);
404
405 grand_child_->set_expected_occlusion(gfx::Rect(10, 0, 10, 190));
406 child_->set_expected_occlusion(gfx::Rect(0, 0, 20, 190));
407 root_->set_expected_occlusion(gfx::Rect(20, 10, 10, 190));
408
409 layer_tree_host()->SetRootLayer(root_);
410 LayerTreeTest::SetupTree();
411 }
412 };
413
414 SINGLE_AND_MULTI_THREAD_TEST_F(
415 LayerTreeHostOcclusionTestOcclusionBlendingBelowOcclusion);
416
349 class LayerTreeHostOcclusionTestOcclusionOpacityFilter 417 class LayerTreeHostOcclusionTestOcclusionOpacityFilter
350 : public LayerTreeHostOcclusionTest { 418 : public LayerTreeHostOcclusionTest {
351 public: 419 public:
352 virtual void SetupTree() OVERRIDE { 420 virtual void SetupTree() OVERRIDE {
353 gfx::Transform child_transform; 421 gfx::Transform child_transform;
354 child_transform.Translate(250.0, 250.0); 422 child_transform.Translate(250.0, 250.0);
355 child_transform.Rotate(90.0); 423 child_transform.Rotate(90.0);
356 child_transform.Translate(-250.0, -250.0); 424 child_transform.Translate(-250.0, -250.0);
357 425
358 FilterOperations filters; 426 FilterOperations filters;
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 614
547 layer_tree_host()->SetRootLayer(layers[0]); 615 layer_tree_host()->SetRootLayer(layers[0]);
548 LayerTreeTest::SetupTree(); 616 LayerTreeTest::SetupTree();
549 } 617 }
550 }; 618 };
551 619
552 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestManySurfaces); 620 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestManySurfaces);
553 621
554 } // namespace 622 } // namespace
555 } // namespace cc 623 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_pixeltest_blending.cc ('k') | cc/trees/occlusion_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698