OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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_common.h" | 5 #include "cc/trees/layer_tree_host_common.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1560 child->render_surface()->DrawableContentRect()); | 1560 child->render_surface()->DrawableContentRect()); |
1561 } | 1561 } |
1562 | 1562 |
1563 TEST_F(LayerTreeHostCommonTest, RenderSurfaceForBlendMode) { | 1563 TEST_F(LayerTreeHostCommonTest, RenderSurfaceForBlendMode) { |
1564 LayerImpl* root = root_layer_for_testing(); | 1564 LayerImpl* root = root_layer_for_testing(); |
1565 LayerImpl* child = AddChild<LayerImpl>(root); | 1565 LayerImpl* child = AddChild<LayerImpl>(root); |
1566 | 1566 |
1567 root->SetBounds(gfx::Size(10, 10)); | 1567 root->SetBounds(gfx::Size(10, 10)); |
1568 child->SetBounds(gfx::Size(10, 10)); | 1568 child->SetBounds(gfx::Size(10, 10)); |
1569 child->SetDrawsContent(true); | 1569 child->SetDrawsContent(true); |
1570 child->test_properties()->blend_mode = SkXfermode::kMultiply_Mode; | 1570 child->test_properties()->blend_mode = SkBlendMode::kMultiply; |
1571 child->test_properties()->opacity = 0.5f; | 1571 child->test_properties()->opacity = 0.5f; |
1572 child->test_properties()->force_render_surface = true; | 1572 child->test_properties()->force_render_surface = true; |
1573 ExecuteCalculateDrawProperties(root); | 1573 ExecuteCalculateDrawProperties(root); |
1574 | 1574 |
1575 // Since the child layer has a blend mode other than normal, it should get | 1575 // Since the child layer has a blend mode other than normal, it should get |
1576 // its own render surface. Also, layer's draw_properties should contain the | 1576 // its own render surface. Also, layer's draw_properties should contain the |
1577 // default blend mode, since the render surface becomes responsible for | 1577 // default blend mode, since the render surface becomes responsible for |
1578 // applying the blend mode. | 1578 // applying the blend mode. |
1579 ASSERT_TRUE(child->render_surface()); | 1579 ASSERT_TRUE(child->render_surface()); |
1580 EXPECT_EQ(1.0f, child->draw_opacity()); | 1580 EXPECT_EQ(1.0f, child->draw_opacity()); |
1581 EXPECT_EQ(0.5f, child->render_surface()->draw_opacity()); | 1581 EXPECT_EQ(0.5f, child->render_surface()->draw_opacity()); |
1582 EXPECT_EQ(SkXfermode::kSrcOver_Mode, child->draw_blend_mode()); | 1582 EXPECT_EQ(SkBlendMode::kSrcOver, child->draw_blend_mode()); |
1583 } | 1583 } |
1584 | 1584 |
1585 TEST_F(LayerTreeHostCommonTest, RenderSurfaceDrawOpacity) { | 1585 TEST_F(LayerTreeHostCommonTest, RenderSurfaceDrawOpacity) { |
1586 LayerImpl* root = root_layer_for_testing(); | 1586 LayerImpl* root = root_layer_for_testing(); |
1587 LayerImpl* surface1 = AddChildToRoot<LayerImpl>(); | 1587 LayerImpl* surface1 = AddChildToRoot<LayerImpl>(); |
1588 LayerImpl* not_surface = AddChild<LayerImpl>(surface1); | 1588 LayerImpl* not_surface = AddChild<LayerImpl>(surface1); |
1589 LayerImpl* surface2 = AddChild<LayerImpl>(not_surface); | 1589 LayerImpl* surface2 = AddChild<LayerImpl>(not_surface); |
1590 | 1590 |
1591 root->SetBounds(gfx::Size(10, 10)); | 1591 root->SetBounds(gfx::Size(10, 10)); |
1592 surface1->SetBounds(gfx::Size(10, 10)); | 1592 surface1->SetBounds(gfx::Size(10, 10)); |
(...skipping 8941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10534 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10534 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
10535 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10535 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
10536 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10536 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
10537 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10537 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
10538 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10538 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
10539 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10539 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
10540 } | 10540 } |
10541 | 10541 |
10542 } // namespace | 10542 } // namespace |
10543 } // namespace cc | 10543 } // namespace cc |
OLD | NEW |