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 3507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3518 Occlusion expected_occlusion(translate, SimpleEnclosedRegion(gfx::Rect()), | 3518 Occlusion expected_occlusion(translate, SimpleEnclosedRegion(gfx::Rect()), |
3519 SimpleEnclosedRegion(gfx::Rect(200, 200))); | 3519 SimpleEnclosedRegion(gfx::Rect(200, 200))); |
3520 EXPECT_TRUE(expected_occlusion.IsEqual(actual_occlusion)); | 3520 EXPECT_TRUE(expected_occlusion.IsEqual(actual_occlusion)); |
3521 | 3521 |
3522 // Mask layer should have the same occlusion. | 3522 // Mask layer should have the same occlusion. |
3523 actual_occlusion = | 3523 actual_occlusion = |
3524 surface_child_mask_ptr->draw_properties().occlusion_in_content_space; | 3524 surface_child_mask_ptr->draw_properties().occlusion_in_content_space; |
3525 EXPECT_TRUE(expected_occlusion.IsEqual(actual_occlusion)); | 3525 EXPECT_TRUE(expected_occlusion.IsEqual(actual_occlusion)); |
3526 } | 3526 } |
3527 | 3527 |
3528 TEST_F(LayerTreeHostCommonTest, TextureLayerSnapping) { | |
3529 FakeImplTaskRunnerProvider task_runner_provider; | |
3530 TestSharedBitmapManager shared_bitmap_manager; | |
3531 TestTaskGraphRunner task_graph_runner; | |
3532 std::unique_ptr<CompositorFrameSink> compositor_frame_sink = | |
3533 FakeCompositorFrameSink::Create3d(); | |
3534 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | |
3535 &task_graph_runner); | |
3536 | |
3537 std::unique_ptr<LayerImpl> root = | |
3538 LayerImpl::Create(host_impl.active_tree(), 1); | |
3539 std::unique_ptr<TextureLayerImpl> child = | |
3540 TextureLayerImpl::Create(host_impl.active_tree(), 2); | |
3541 | |
3542 LayerImpl* child_ptr = child.get(); | |
3543 | |
3544 root->SetBounds(gfx::Size(100, 100)); | |
3545 child->SetBounds(gfx::Size(100, 100)); | |
3546 child->SetDrawsContent(true); | |
3547 gfx::Transform fractional_translate; | |
3548 fractional_translate.Translate(10.5f, 10.5f); | |
enne (OOO)
2016/10/26 20:32:32
Can you use a translation in of these components w
jaydasika
2016/10/26 21:49:13
Done.
| |
3549 child->test_properties()->transform = fractional_translate; | |
3550 | |
3551 host_impl.SetViewportSize(root->bounds()); | |
3552 | |
3553 root->test_properties()->AddChild(std::move(child)); | |
3554 host_impl.active_tree()->SetRootLayerForTesting(std::move(root)); | |
3555 host_impl.SetVisible(true); | |
3556 host_impl.InitializeRenderer(compositor_frame_sink.get()); | |
3557 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | |
3558 bool update_lcd_text = false; | |
3559 host_impl.active_tree()->UpdateDrawProperties(update_lcd_text); | |
3560 | |
3561 EXPECT_NE(child_ptr->ScreenSpaceTransform(), fractional_translate); | |
3562 fractional_translate.RoundTranslationComponents(); | |
3563 EXPECT_TRANSFORMATION_MATRIX_EQ(child_ptr->ScreenSpaceTransform(), | |
enne (OOO)
2016/10/26 20:32:32
Could you also map this rect into screen space and
jaydasika
2016/10/26 21:49:13
Done.
| |
3564 fractional_translate); | |
3565 } | |
3566 | |
3528 TEST_F(LayerTreeHostCommonTest, | 3567 TEST_F(LayerTreeHostCommonTest, |
3529 OcclusionForLayerWithUninvertibleDrawTransform) { | 3568 OcclusionForLayerWithUninvertibleDrawTransform) { |
3530 FakeImplTaskRunnerProvider task_runner_provider; | 3569 FakeImplTaskRunnerProvider task_runner_provider; |
3531 TestSharedBitmapManager shared_bitmap_manager; | 3570 TestSharedBitmapManager shared_bitmap_manager; |
3532 TestTaskGraphRunner task_graph_runner; | 3571 TestTaskGraphRunner task_graph_runner; |
3533 std::unique_ptr<CompositorFrameSink> compositor_frame_sink = | 3572 std::unique_ptr<CompositorFrameSink> compositor_frame_sink = |
3534 FakeCompositorFrameSink::Create3d(); | 3573 FakeCompositorFrameSink::Create3d(); |
3535 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 3574 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
3536 &task_graph_runner); | 3575 &task_graph_runner); |
3537 | 3576 |
(...skipping 6836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10374 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10413 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
10375 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10414 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
10376 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10415 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
10377 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10416 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
10378 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10417 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
10379 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10418 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
10380 } | 10419 } |
10381 | 10420 |
10382 } // namespace | 10421 } // namespace |
10383 } // namespace cc | 10422 } // namespace cc |
OLD | NEW |