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

Unified 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, 1 month 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_unittest_occlusion.cc
diff --git a/cc/trees/layer_tree_host_unittest_occlusion.cc b/cc/trees/layer_tree_host_unittest_occlusion.cc
index 9300f30e156f4bab5290acd59cbb1b18a6d7bdca..621d23d360fddbe30c9d5fc608093675ff0ab0cf 100644
--- a/cc/trees/layer_tree_host_unittest_occlusion.cc
+++ b/cc/trees/layer_tree_host_unittest_occlusion.cc
@@ -346,6 +346,74 @@ class LayerTreeHostOcclusionTestOcclusionOpacityBelowOcclusion
SINGLE_AND_MULTI_THREAD_TEST_F(
LayerTreeHostOcclusionTestOcclusionOpacityBelowOcclusion);
+class LayerTreeHostOcclusionTestOcclusionBlending
+ : public LayerTreeHostOcclusionTest {
+ public:
+ virtual void SetupTree() OVERRIDE {
+ // If the child layer has a blend mode, then it shouldn't
+ // contribute to occlusion on stuff below it
+ SetLayerPropertiesForTesting(
+ root_.get(), NULL, identity_matrix_,
+ gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true);
+ SetLayerPropertiesForTesting(
+ child2_.get(), root_.get(), identity_matrix_,
+ gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true);
+ SetLayerPropertiesForTesting(
+ child_.get(), root_.get(), identity_matrix_,
+ gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true);
+ SetLayerPropertiesForTesting(
+ grand_child_.get(), child_.get(), identity_matrix_,
+ gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true);
+
+ child_->SetMasksToBounds(true);
+ child_->SetBlendMode(SkXfermode::kMultiply_Mode);
+ child_->SetForceRenderSurface(true);
+
+ child_->set_expected_occlusion(gfx::Rect(0, 0, 10, 190));
+ root_->set_expected_occlusion(gfx::Rect(20, 10, 10, 190));
+
+ layer_tree_host()->SetRootLayer(root_);
+ LayerTreeTest::SetupTree();
+ }
+};
+
+SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionBlending);
+
+class LayerTreeHostOcclusionTestOcclusionBlendingBelowOcclusion
+ : public LayerTreeHostOcclusionTest {
+ public:
+ virtual void SetupTree() OVERRIDE {
+ // If the child layer with a blend mode is below child2, then
+ // child2 should contribute to occlusion on everything, and child shouldn't
+ // contribute to the root_.
+ SetLayerPropertiesForTesting(
+ root_.get(), NULL, identity_matrix_,
+ gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true);
+ SetLayerPropertiesForTesting(
+ child_.get(), root_.get(), identity_matrix_,
+ gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true);
+ SetLayerPropertiesForTesting(
+ grand_child_.get(), child_.get(), identity_matrix_,
+ gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true);
+ SetLayerPropertiesForTesting(
+ child2_.get(), root_.get(), identity_matrix_,
+ gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true);
+
+ child_->SetMasksToBounds(true);
+ child_->SetBlendMode(SkXfermode::kMultiply_Mode);
+
+ grand_child_->set_expected_occlusion(gfx::Rect(10, 0, 10, 190));
+ child_->set_expected_occlusion(gfx::Rect(0, 0, 20, 190));
+ root_->set_expected_occlusion(gfx::Rect(20, 10, 10, 190));
+
+ layer_tree_host()->SetRootLayer(root_);
+ LayerTreeTest::SetupTree();
+ }
+};
+
+SINGLE_AND_MULTI_THREAD_TEST_F(
+ LayerTreeHostOcclusionTestOcclusionBlendingBelowOcclusion);
+
class LayerTreeHostOcclusionTestOcclusionOpacityFilter
: public LayerTreeHostOcclusionTest {
public:
« 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