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

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 723343002: Update from https://crrev.com/304121 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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_common.cc ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_common_unittest.cc
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index e0436bad3cca6f0f732ca8c30e6316972c1edf9e..b40f66db486ddf63d9191fe933b0d195e9deb456 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -1392,6 +1392,36 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceListForTransparentChild) {
EXPECT_EQ(gfx::Rect(), parent->drawable_content_rect());
}
+TEST_F(LayerTreeHostCommonTest, RenderSurfaceForBlendMode) {
+ scoped_refptr<Layer> parent = Layer::Create();
+ scoped_refptr<LayerWithForcedDrawsContent> child =
+ make_scoped_refptr(new LayerWithForcedDrawsContent());
+
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
+ host->SetRootLayer(parent);
+
+ const gfx::Transform identity_matrix;
+ const SkXfermode::Mode blend_mode = SkXfermode::kMultiply_Mode;
+ SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(10, 10), true, false);
+
+ parent->AddChild(child);
+ child->SetBlendMode(blend_mode);
+
+ RenderSurfaceLayerList render_surface_layer_list;
+ LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs(
+ parent.get(), parent->bounds(), &render_surface_layer_list);
+ LayerTreeHostCommon::CalculateDrawProperties(&inputs);
+
+ // Since the child layer has a blend mode other than normal, it should get
+ // its own render surface. Also, layer's draw_properties should contain the
+ // default blend mode, since the render surface becomes responsible for
+ // applying the blend mode.
+ ASSERT_TRUE(child->render_surface());
+ EXPECT_EQ(1U, child->render_surface()->layer_list().size());
+ EXPECT_EQ(SkXfermode::kSrcOver_Mode, child->draw_properties().blend_mode);
+}
+
TEST_F(LayerTreeHostCommonTest, ForceRenderSurface) {
scoped_refptr<Layer> parent = Layer::Create();
scoped_refptr<Layer> render_surface1 = Layer::Create();
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698