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 "cc/animation/layer_animation_controller.h" | 7 #include "cc/animation/layer_animation_controller.h" |
8 #include "cc/base/math_util.h" | 8 #include "cc/base/math_util.h" |
9 #include "cc/base/thread.h" | 9 #include "cc/base/thread.h" |
10 #include "cc/layers/content_layer.h" | 10 #include "cc/layers/content_layer.h" |
(...skipping 3701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3712 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child1->visible_content_rect()); | 3712 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child1->visible_content_rect()); |
3713 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child2->visible_content_rect()); | 3713 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child2->visible_content_rect()); |
3714 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child3->visible_content_rect()); | 3714 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child3->visible_content_rect()); |
3715 | 3715 |
3716 EXPECT_RECT_EQ(gfx::Rect(5, 5, 50, 50), child1->drawable_content_rect()); | 3716 EXPECT_RECT_EQ(gfx::Rect(5, 5, 50, 50), child1->drawable_content_rect()); |
3717 EXPECT_RECT_EQ(gfx::Rect(75, 75, 50, 50), child2->drawable_content_rect()); | 3717 EXPECT_RECT_EQ(gfx::Rect(75, 75, 50, 50), child2->drawable_content_rect()); |
3718 EXPECT_RECT_EQ(gfx::Rect(125, 125, 50, 50), child3->drawable_content_rect()); | 3718 EXPECT_RECT_EQ(gfx::Rect(125, 125, 50, 50), child3->drawable_content_rect()); |
3719 } | 3719 } |
3720 | 3720 |
3721 TEST(LayerTreeHostCommonTest, | 3721 TEST(LayerTreeHostCommonTest, |
| 3722 DrawableAndVisibleContentRectsForLayersWithUninvertibleTransform) { |
| 3723 scoped_refptr<Layer> root = Layer::Create(); |
| 3724 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 3725 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 3726 root->AddChild(child); |
| 3727 |
| 3728 gfx::Transform identity_matrix; |
| 3729 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); |
| 3730 |
| 3731 SetLayerPropertiesForTesting(root.get(), |
| 3732 identity_matrix, |
| 3733 identity_matrix, |
| 3734 gfx::PointF(), |
| 3735 gfx::PointF(), |
| 3736 gfx::Size(100, 100), |
| 3737 false); |
| 3738 SetLayerPropertiesForTesting(child.get(), |
| 3739 uninvertible_matrix, |
| 3740 identity_matrix, |
| 3741 gfx::PointF(), |
| 3742 gfx::PointF(5.f, 5.f), |
| 3743 gfx::Size(50, 50), |
| 3744 false); |
| 3745 |
| 3746 ExecuteCalculateDrawProperties(root.get()); |
| 3747 |
| 3748 EXPECT_TRUE(child->visible_content_rect().IsEmpty()); |
| 3749 EXPECT_TRUE(child->drawable_content_rect().IsEmpty()); |
| 3750 } |
| 3751 |
| 3752 TEST(LayerTreeHostCommonTest, |
3722 DrawableAndVisibleContentRectsForLayersInClippedRenderSurface) { | 3753 DrawableAndVisibleContentRectsForLayersInClippedRenderSurface) { |
3723 scoped_refptr<Layer> root = Layer::Create(); | 3754 scoped_refptr<Layer> root = Layer::Create(); |
3724 scoped_refptr<Layer> render_surface1 = Layer::Create(); | 3755 scoped_refptr<Layer> render_surface1 = Layer::Create(); |
3725 scoped_refptr<LayerWithForcedDrawsContent> child1 = | 3756 scoped_refptr<LayerWithForcedDrawsContent> child1 = |
3726 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3757 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
3727 scoped_refptr<LayerWithForcedDrawsContent> child2 = | 3758 scoped_refptr<LayerWithForcedDrawsContent> child2 = |
3728 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3759 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
3729 scoped_refptr<LayerWithForcedDrawsContent> child3 = | 3760 scoped_refptr<LayerWithForcedDrawsContent> child3 = |
3730 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3761 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
3731 root->AddChild(render_surface1); | 3762 root->AddChild(render_surface1); |
(...skipping 4415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8147 EXPECT_EQ(can_use_lcd_text_, child_->can_use_lcd_text()); | 8178 EXPECT_EQ(can_use_lcd_text_, child_->can_use_lcd_text()); |
8148 EXPECT_EQ(can_use_lcd_text_, grand_child_->can_use_lcd_text()); | 8179 EXPECT_EQ(can_use_lcd_text_, grand_child_->can_use_lcd_text()); |
8149 } | 8180 } |
8150 | 8181 |
8151 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest, | 8182 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest, |
8152 LCDTextTest, | 8183 LCDTextTest, |
8153 testing::Combine(testing::Bool(), testing::Bool())); | 8184 testing::Combine(testing::Bool(), testing::Bool())); |
8154 | 8185 |
8155 } // namespace | 8186 } // namespace |
8156 } // namespace cc | 8187 } // namespace cc |
OLD | NEW |