Chromium Code Reviews| 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 <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "cc/animation/layer_animation_controller.h" | 9 #include "cc/animation/layer_animation_controller.h" |
| 10 #include "cc/animation/transform_operations.h" | 10 #include "cc/animation/transform_operations.h" |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 302 LayerImpl::Create(host_impl.active_tree(), 1)); | 302 LayerImpl::Create(host_impl.active_tree(), 1)); |
| 303 LayerImpl* sublayer = sublayer_scoped_ptr.get(); | 303 LayerImpl* sublayer = sublayer_scoped_ptr.get(); |
| 304 sublayer->SetContentsScale(kPageScale * kDeviceScale, | 304 sublayer->SetContentsScale(kPageScale * kDeviceScale, |
| 305 kPageScale * kDeviceScale); | 305 kPageScale * kDeviceScale); |
| 306 SetLayerPropertiesForTesting(sublayer, | 306 SetLayerPropertiesForTesting(sublayer, |
| 307 identity_matrix, | 307 identity_matrix, |
| 308 gfx::Point3F(), | 308 gfx::Point3F(), |
| 309 gfx::PointF(), | 309 gfx::PointF(), |
| 310 gfx::Size(500, 500), | 310 gfx::Size(500, 500), |
| 311 true, | 311 true, |
| 312 false, | |
| 312 false); | 313 false); |
| 313 | 314 |
| 314 scoped_ptr<LayerImpl> scroll_layer_scoped_ptr( | 315 scoped_ptr<LayerImpl> scroll_layer_scoped_ptr( |
| 315 LayerImpl::Create(host_impl.active_tree(), 2)); | 316 LayerImpl::Create(host_impl.active_tree(), 2)); |
| 316 LayerImpl* scroll_layer = scroll_layer_scoped_ptr.get(); | 317 LayerImpl* scroll_layer = scroll_layer_scoped_ptr.get(); |
| 317 SetLayerPropertiesForTesting(scroll_layer, | 318 SetLayerPropertiesForTesting(scroll_layer, |
| 318 identity_matrix, | 319 identity_matrix, |
| 319 gfx::Point3F(), | 320 gfx::Point3F(), |
| 320 gfx::PointF(), | 321 gfx::PointF(), |
| 321 gfx::Size(10, 20), | 322 gfx::Size(10, 20), |
| 322 true, | 323 true, |
| 324 false, | |
| 323 false); | 325 false); |
| 324 scoped_ptr<LayerImpl> clip_layer_scoped_ptr( | 326 scoped_ptr<LayerImpl> clip_layer_scoped_ptr( |
| 325 LayerImpl::Create(host_impl.active_tree(), 4)); | 327 LayerImpl::Create(host_impl.active_tree(), 4)); |
| 326 LayerImpl* clip_layer = clip_layer_scoped_ptr.get(); | 328 LayerImpl* clip_layer = clip_layer_scoped_ptr.get(); |
| 327 | 329 |
| 328 scroll_layer->SetScrollClipLayer(clip_layer->id()); | 330 scroll_layer->SetScrollClipLayer(clip_layer->id()); |
| 329 clip_layer->SetBounds( | 331 clip_layer->SetBounds( |
| 330 gfx::Size(scroll_layer->bounds().width() + kMaxScrollOffset.x(), | 332 gfx::Size(scroll_layer->bounds().width() + kMaxScrollOffset.x(), |
| 331 scroll_layer->bounds().height() + kMaxScrollOffset.y())); | 333 scroll_layer->bounds().height() + kMaxScrollOffset.y())); |
| 332 scroll_layer->SetScrollClipLayer(clip_layer->id()); | 334 scroll_layer->SetScrollClipLayer(clip_layer->id()); |
| 333 scroll_layer->SetScrollDelta(kScrollDelta); | 335 scroll_layer->SetScrollDelta(kScrollDelta); |
| 334 gfx::Transform impl_transform; | 336 gfx::Transform impl_transform; |
| 335 scroll_layer->AddChild(sublayer_scoped_ptr.Pass()); | 337 scroll_layer->AddChild(sublayer_scoped_ptr.Pass()); |
| 336 LayerImpl* scroll_layer_raw_ptr = scroll_layer_scoped_ptr.get(); | 338 LayerImpl* scroll_layer_raw_ptr = scroll_layer_scoped_ptr.get(); |
| 337 clip_layer->AddChild(scroll_layer_scoped_ptr.Pass()); | 339 clip_layer->AddChild(scroll_layer_scoped_ptr.Pass()); |
| 338 scroll_layer_raw_ptr->SetScrollOffset(kScrollOffset); | 340 scroll_layer_raw_ptr->SetScrollOffset(kScrollOffset); |
| 339 | 341 |
| 340 scoped_ptr<LayerImpl> root(LayerImpl::Create(host_impl.active_tree(), 3)); | 342 scoped_ptr<LayerImpl> root(LayerImpl::Create(host_impl.active_tree(), 3)); |
| 341 SetLayerPropertiesForTesting(root.get(), | 343 SetLayerPropertiesForTesting(root.get(), |
| 342 identity_matrix, | 344 identity_matrix, |
| 343 gfx::Point3F(), | 345 gfx::Point3F(), |
| 344 gfx::PointF(), | 346 gfx::PointF(), |
| 345 gfx::Size(3, 4), | 347 gfx::Size(3, 4), |
| 346 true, | 348 true, |
| 349 false, | |
| 347 false); | 350 false); |
| 348 root->AddChild(clip_layer_scoped_ptr.Pass()); | 351 root->AddChild(clip_layer_scoped_ptr.Pass()); |
| 352 root->SetHasRenderSurface(true); | |
| 349 | 353 |
| 350 ExecuteCalculateDrawProperties( | 354 ExecuteCalculateDrawProperties( |
| 351 root.get(), kDeviceScale, kPageScale, scroll_layer->parent()); | 355 root.get(), kDeviceScale, kPageScale, scroll_layer->parent()); |
| 352 gfx::Transform expected_transform = identity_matrix; | 356 gfx::Transform expected_transform = identity_matrix; |
| 353 gfx::PointF sub_layer_screen_position = kScrollLayerPosition - kScrollDelta; | 357 gfx::PointF sub_layer_screen_position = kScrollLayerPosition - kScrollDelta; |
| 354 sub_layer_screen_position.Scale(kPageScale * kDeviceScale); | 358 sub_layer_screen_position.Scale(kPageScale * kDeviceScale); |
| 355 expected_transform.Translate(MathUtil::Round(sub_layer_screen_position.x()), | 359 expected_transform.Translate(MathUtil::Round(sub_layer_screen_position.x()), |
| 356 MathUtil::Round(sub_layer_screen_position.y())); | 360 MathUtil::Round(sub_layer_screen_position.y())); |
| 357 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, | 361 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, |
| 358 sublayer->draw_transform()); | 362 sublayer->draw_transform()); |
| 359 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, | 363 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, |
| 360 sublayer->screen_space_transform()); | 364 sublayer->screen_space_transform()); |
| 361 | 365 |
| 362 gfx::Transform arbitrary_translate; | 366 gfx::Transform arbitrary_translate; |
| 363 const float kTranslateX = 10.6f; | 367 const float kTranslateX = 10.6f; |
| 364 const float kTranslateY = 20.6f; | 368 const float kTranslateY = 20.6f; |
| 365 arbitrary_translate.Translate(kTranslateX, kTranslateY); | 369 arbitrary_translate.Translate(kTranslateX, kTranslateY); |
| 366 SetLayerPropertiesForTesting(scroll_layer, | 370 SetLayerPropertiesForTesting(scroll_layer, |
| 367 arbitrary_translate, | 371 arbitrary_translate, |
| 368 gfx::Point3F(), | 372 gfx::Point3F(), |
| 369 gfx::PointF(), | 373 gfx::PointF(), |
| 370 gfx::Size(10, 20), | 374 gfx::Size(10, 20), |
| 371 true, | 375 true, |
| 376 false, | |
| 372 false); | 377 false); |
| 373 ExecuteCalculateDrawProperties( | 378 ExecuteCalculateDrawProperties( |
| 374 root.get(), kDeviceScale, kPageScale, scroll_layer->parent()); | 379 root.get(), kDeviceScale, kPageScale, scroll_layer->parent()); |
| 375 expected_transform.MakeIdentity(); | 380 expected_transform.MakeIdentity(); |
| 376 expected_transform.Translate( | 381 expected_transform.Translate( |
| 377 MathUtil::Round(kTranslateX * kPageScale * kDeviceScale + | 382 MathUtil::Round(kTranslateX * kPageScale * kDeviceScale + |
| 378 sub_layer_screen_position.x()), | 383 sub_layer_screen_position.x()), |
| 379 MathUtil::Round(kTranslateY * kPageScale * kDeviceScale + | 384 MathUtil::Round(kTranslateY * kPageScale * kDeviceScale + |
| 380 sub_layer_screen_position.y())); | 385 sub_layer_screen_position.y())); |
| 381 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, | 386 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, |
| (...skipping 3320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3702 gfx::Size(100, 100), | 3707 gfx::Size(100, 100), |
| 3703 true, | 3708 true, |
| 3704 true); | 3709 true); |
| 3705 | 3710 |
| 3706 RenderSurfaceLayerList render_surface_layer_list; | 3711 RenderSurfaceLayerList render_surface_layer_list; |
| 3707 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 3712 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 3708 parent.get(), parent->bounds(), &render_surface_layer_list); | 3713 parent.get(), parent->bounds(), &render_surface_layer_list); |
| 3709 inputs.can_adjust_raster_scales = true; | 3714 inputs.can_adjust_raster_scales = true; |
| 3710 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 3715 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 3711 | 3716 |
| 3712 // Verify which render surfaces were created. | 3717 // Verify which render surfaces were created. |
|
danakj
2014/09/03 19:30:34
created and used?
awoloszyn
2014/09/09 15:31:37
Done.
| |
| 3713 EXPECT_FALSE(front_facing_child->render_surface()); | 3718 EXPECT_FALSE(front_facing_child->render_surface()); |
| 3714 EXPECT_FALSE(back_facing_child->render_surface()); | 3719 EXPECT_FALSE(back_facing_child->render_surface()); |
| 3715 EXPECT_TRUE(front_facing_surface->render_surface()); | 3720 EXPECT_TRUE(front_facing_surface->render_surface()); |
| 3716 EXPECT_FALSE(back_facing_surface->render_surface()); | 3721 EXPECT_FALSE(back_facing_surface->render_target() == back_facing_surface); |
|
danakj
2014/09/03 19:30:34
should we check that the surface was created also,
danakj
2014/09/03 19:30:35
EXPECT_NE
awoloszyn
2014/09/09 15:31:37
Done.
awoloszyn
2014/09/09 15:31:37
Correct, we should probably make sure that it was
| |
| 3717 EXPECT_FALSE(front_facing_child_of_front_facing_surface->render_surface()); | 3722 EXPECT_FALSE(front_facing_child_of_front_facing_surface->render_surface()); |
| 3718 EXPECT_FALSE(back_facing_child_of_front_facing_surface->render_surface()); | 3723 EXPECT_FALSE(back_facing_child_of_front_facing_surface->render_surface()); |
| 3719 EXPECT_FALSE(front_facing_child_of_back_facing_surface->render_surface()); | 3724 EXPECT_FALSE(front_facing_child_of_back_facing_surface->render_surface()); |
| 3720 EXPECT_FALSE(back_facing_child_of_back_facing_surface->render_surface()); | 3725 EXPECT_FALSE(back_facing_child_of_back_facing_surface->render_surface()); |
| 3721 | 3726 |
| 3722 // Verify the render_surface_layer_list. The back-facing surface should be | 3727 // Verify the render_surface_layer_list. The back-facing surface should be |
| 3723 // culled. | 3728 // culled. |
| 3724 ASSERT_EQ(2u, render_surface_layer_list.size()); | 3729 ASSERT_EQ(2u, render_surface_layer_list.size()); |
| 3725 EXPECT_EQ(parent->id(), render_surface_layer_list.at(0)->id()); | 3730 EXPECT_EQ(parent->id(), render_surface_layer_list.at(0)->id()); |
| 3726 EXPECT_EQ(front_facing_surface->id(), render_surface_layer_list.at(1)->id()); | 3731 EXPECT_EQ(front_facing_surface->id(), render_surface_layer_list.at(1)->id()); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3970 | 3975 |
| 3971 front_facing_surface->Set3dSortingContextId(1); | 3976 front_facing_surface->Set3dSortingContextId(1); |
| 3972 back_facing_surface->Set3dSortingContextId(1); | 3977 back_facing_surface->Set3dSortingContextId(1); |
| 3973 | 3978 |
| 3974 RenderSurfaceLayerList render_surface_layer_list; | 3979 RenderSurfaceLayerList render_surface_layer_list; |
| 3975 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 3980 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 3976 parent.get(), parent->bounds(), &render_surface_layer_list); | 3981 parent.get(), parent->bounds(), &render_surface_layer_list); |
| 3977 inputs.can_adjust_raster_scales = true; | 3982 inputs.can_adjust_raster_scales = true; |
| 3978 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 3983 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 3979 | 3984 |
| 3980 // Verify which render surfaces were created. | 3985 // Verify which render surfaces were created. |
|
danakj
2014/09/03 19:30:35
and used?
awoloszyn
2014/09/09 15:31:37
Done.
| |
| 3981 EXPECT_TRUE(front_facing_surface->render_surface()); | 3986 EXPECT_TRUE(front_facing_surface->render_surface()); |
| 3982 EXPECT_FALSE( | 3987 EXPECT_FALSE(back_facing_surface->render_target() == |
|
danakj
2014/09/03 19:30:34
should we check that the surface was created also,
danakj
2014/09/03 19:30:35
EXPECT_NE
awoloszyn
2014/09/09 15:31:37
Done.
awoloszyn
2014/09/09 15:31:37
Done.
| |
| 3983 back_facing_surface->render_surface()); // because it should be culled | 3988 back_facing_surface); // because it should be culled |
| 3984 EXPECT_FALSE(child1->render_surface()); | 3989 EXPECT_FALSE(child1->render_surface()); |
| 3985 EXPECT_FALSE(child2->render_surface()); | 3990 EXPECT_FALSE(child2->render_surface()); |
| 3986 | 3991 |
| 3987 // Verify the render_surface_layer_list. The back-facing surface should be | 3992 // Verify the render_surface_layer_list. The back-facing surface should be |
| 3988 // culled. | 3993 // culled. |
| 3989 ASSERT_EQ(2u, render_surface_layer_list.size()); | 3994 ASSERT_EQ(2u, render_surface_layer_list.size()); |
| 3990 EXPECT_EQ(parent->id(), render_surface_layer_list.at(0)->id()); | 3995 EXPECT_EQ(parent->id(), render_surface_layer_list.at(0)->id()); |
| 3991 EXPECT_EQ(front_facing_surface->id(), render_surface_layer_list.at(1)->id()); | 3996 EXPECT_EQ(front_facing_surface->id(), render_surface_layer_list.at(1)->id()); |
| 3992 | 3997 |
| 3993 // Verify root surface's layer list. | 3998 // Verify root surface's layer list. |
| (...skipping 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5629 host_impl.CreatePendingTree(); | 5634 host_impl.CreatePendingTree(); |
| 5630 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); | 5635 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); |
| 5631 | 5636 |
| 5632 const gfx::Transform identity_matrix; | 5637 const gfx::Transform identity_matrix; |
| 5633 SetLayerPropertiesForTesting(root.get(), | 5638 SetLayerPropertiesForTesting(root.get(), |
| 5634 identity_matrix, | 5639 identity_matrix, |
| 5635 gfx::Point3F(), | 5640 gfx::Point3F(), |
| 5636 gfx::PointF(), | 5641 gfx::PointF(), |
| 5637 gfx::Size(100, 100), | 5642 gfx::Size(100, 100), |
| 5638 true, | 5643 true, |
| 5644 false, | |
| 5639 false); | 5645 false); |
| 5640 root->SetDrawsContent(true); | 5646 root->SetDrawsContent(true); |
| 5641 | 5647 |
| 5642 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); | 5648 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); |
| 5643 SetLayerPropertiesForTesting(child.get(), | 5649 SetLayerPropertiesForTesting(child.get(), |
| 5644 identity_matrix, | 5650 identity_matrix, |
| 5645 gfx::Point3F(), | 5651 gfx::Point3F(), |
| 5646 gfx::PointF(), | 5652 gfx::PointF(), |
| 5647 gfx::Size(50, 50), | 5653 gfx::Size(50, 50), |
| 5648 true, | 5654 true, |
| 5655 false, | |
| 5649 false); | 5656 false); |
| 5650 child->SetDrawsContent(true); | 5657 child->SetDrawsContent(true); |
| 5651 child->SetOpacity(0.0f); | 5658 child->SetOpacity(0.0f); |
| 5652 | 5659 |
| 5653 // Add opacity animation. | 5660 // Add opacity animation. |
| 5654 AddOpacityTransitionToController( | 5661 AddOpacityTransitionToController( |
| 5655 child->layer_animation_controller(), 10.0, 0.0f, 1.0f, false); | 5662 child->layer_animation_controller(), 10.0, 0.0f, 1.0f, false); |
| 5656 | 5663 |
| 5657 root->AddChild(child.Pass()); | 5664 root->AddChild(child.Pass()); |
| 5665 root->SetHasRenderSurface(true); | |
| 5658 | 5666 |
| 5659 LayerImplList render_surface_layer_list; | 5667 LayerImplList render_surface_layer_list; |
| 5660 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 5668 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 5661 root.get(), root->bounds(), &render_surface_layer_list); | 5669 root.get(), root->bounds(), &render_surface_layer_list); |
| 5662 inputs.can_adjust_raster_scales = true; | 5670 inputs.can_adjust_raster_scales = true; |
| 5663 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 5671 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 5664 | 5672 |
| 5665 // We should have one render surface and two layers. The child | 5673 // We should have one render surface and two layers. The child |
| 5666 // layer should be included even though it is transparent. | 5674 // layer should be included even though it is transparent. |
| 5667 ASSERT_EQ(1u, render_surface_layer_list.size()); | 5675 ASSERT_EQ(1u, render_surface_layer_list.size()); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5887 host_impl.CreatePendingTree(); | 5895 host_impl.CreatePendingTree(); |
| 5888 const gfx::Transform identity_matrix; | 5896 const gfx::Transform identity_matrix; |
| 5889 | 5897 |
| 5890 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); | 5898 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); |
| 5891 SetLayerPropertiesForTesting(root.get(), | 5899 SetLayerPropertiesForTesting(root.get(), |
| 5892 identity_matrix, | 5900 identity_matrix, |
| 5893 gfx::Point3F(), | 5901 gfx::Point3F(), |
| 5894 gfx::PointF(), | 5902 gfx::PointF(), |
| 5895 gfx::Size(50, 50), | 5903 gfx::Size(50, 50), |
| 5896 true, | 5904 true, |
| 5905 false, | |
| 5897 false); | 5906 false); |
| 5898 root->SetDrawsContent(true); | 5907 root->SetDrawsContent(true); |
| 5899 | 5908 |
| 5900 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); | 5909 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); |
| 5901 SetLayerPropertiesForTesting(child.get(), | 5910 SetLayerPropertiesForTesting(child.get(), |
| 5902 identity_matrix, | 5911 identity_matrix, |
| 5903 gfx::Point3F(), | 5912 gfx::Point3F(), |
| 5904 gfx::PointF(), | 5913 gfx::PointF(), |
| 5905 gfx::Size(40, 40), | 5914 gfx::Size(40, 40), |
| 5906 true, | 5915 true, |
| 5916 false, | |
| 5907 false); | 5917 false); |
| 5908 child->SetDrawsContent(true); | 5918 child->SetDrawsContent(true); |
| 5909 | 5919 |
| 5910 scoped_ptr<LayerImpl> grand_child = | 5920 scoped_ptr<LayerImpl> grand_child = |
| 5911 LayerImpl::Create(host_impl.pending_tree(), 3); | 5921 LayerImpl::Create(host_impl.pending_tree(), 3); |
| 5912 SetLayerPropertiesForTesting(grand_child.get(), | 5922 SetLayerPropertiesForTesting(grand_child.get(), |
| 5913 identity_matrix, | 5923 identity_matrix, |
| 5914 gfx::Point3F(), | 5924 gfx::Point3F(), |
| 5915 gfx::PointF(), | 5925 gfx::PointF(), |
| 5916 gfx::Size(30, 30), | 5926 gfx::Size(30, 30), |
| 5917 true, | 5927 true, |
| 5928 false, | |
| 5918 false); | 5929 false); |
| 5919 grand_child->SetDrawsContent(true); | 5930 grand_child->SetDrawsContent(true); |
| 5920 grand_child->SetHideLayerAndSubtree(true); | 5931 grand_child->SetHideLayerAndSubtree(true); |
| 5921 | 5932 |
| 5922 child->AddChild(grand_child.Pass()); | 5933 child->AddChild(grand_child.Pass()); |
| 5923 root->AddChild(child.Pass()); | 5934 root->AddChild(child.Pass()); |
| 5935 root->SetHasRenderSurface(true); | |
| 5924 | 5936 |
| 5925 LayerImplList render_surface_layer_list; | 5937 LayerImplList render_surface_layer_list; |
| 5926 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 5938 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 5927 root.get(), root->bounds(), &render_surface_layer_list); | 5939 root.get(), root->bounds(), &render_surface_layer_list); |
| 5928 inputs.can_adjust_raster_scales = true; | 5940 inputs.can_adjust_raster_scales = true; |
| 5929 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 5941 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 5930 | 5942 |
| 5931 // We should have one render surface and two layers. The grand child has | 5943 // We should have one render surface and two layers. The grand child has |
| 5932 // hidden itself. | 5944 // hidden itself. |
| 5933 ASSERT_EQ(1u, render_surface_layer_list.size()); | 5945 ASSERT_EQ(1u, render_surface_layer_list.size()); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6000 host_impl.CreatePendingTree(); | 6012 host_impl.CreatePendingTree(); |
| 6001 const gfx::Transform identity_matrix; | 6013 const gfx::Transform identity_matrix; |
| 6002 | 6014 |
| 6003 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); | 6015 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); |
| 6004 SetLayerPropertiesForTesting(root.get(), | 6016 SetLayerPropertiesForTesting(root.get(), |
| 6005 identity_matrix, | 6017 identity_matrix, |
| 6006 gfx::Point3F(), | 6018 gfx::Point3F(), |
| 6007 gfx::PointF(), | 6019 gfx::PointF(), |
| 6008 gfx::Size(50, 50), | 6020 gfx::Size(50, 50), |
| 6009 true, | 6021 true, |
| 6022 false, | |
| 6010 false); | 6023 false); |
|
danakj
2014/09/03 19:30:35
true?
awoloszyn
2014/09/09 15:31:37
Done.
| |
| 6011 root->SetDrawsContent(true); | 6024 root->SetDrawsContent(true); |
| 6012 | 6025 |
| 6013 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); | 6026 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); |
| 6014 SetLayerPropertiesForTesting(child.get(), | 6027 SetLayerPropertiesForTesting(child.get(), |
| 6015 identity_matrix, | 6028 identity_matrix, |
| 6016 gfx::Point3F(), | 6029 gfx::Point3F(), |
| 6017 gfx::PointF(), | 6030 gfx::PointF(), |
| 6018 gfx::Size(40, 40), | 6031 gfx::Size(40, 40), |
| 6019 true, | 6032 true, |
| 6033 false, | |
| 6020 false); | 6034 false); |
| 6021 child->SetDrawsContent(true); | 6035 child->SetDrawsContent(true); |
| 6022 child->SetHideLayerAndSubtree(true); | 6036 child->SetHideLayerAndSubtree(true); |
| 6023 | 6037 |
| 6024 scoped_ptr<LayerImpl> grand_child = | 6038 scoped_ptr<LayerImpl> grand_child = |
| 6025 LayerImpl::Create(host_impl.pending_tree(), 3); | 6039 LayerImpl::Create(host_impl.pending_tree(), 3); |
| 6026 SetLayerPropertiesForTesting(grand_child.get(), | 6040 SetLayerPropertiesForTesting(grand_child.get(), |
| 6027 identity_matrix, | 6041 identity_matrix, |
| 6028 gfx::Point3F(), | 6042 gfx::Point3F(), |
| 6029 gfx::PointF(), | 6043 gfx::PointF(), |
| 6030 gfx::Size(30, 30), | 6044 gfx::Size(30, 30), |
| 6031 true, | 6045 true, |
| 6046 false, | |
| 6032 false); | 6047 false); |
| 6033 grand_child->SetDrawsContent(true); | 6048 grand_child->SetDrawsContent(true); |
| 6034 | 6049 |
| 6035 child->AddChild(grand_child.Pass()); | 6050 child->AddChild(grand_child.Pass()); |
| 6036 root->AddChild(child.Pass()); | 6051 root->AddChild(child.Pass()); |
| 6052 root->SetHasRenderSurface(true); | |
|
danakj
2014/09/03 19:30:34
not needed if true above?
awoloszyn
2014/09/09 15:31:37
Done.
| |
| 6037 | 6053 |
| 6038 LayerImplList render_surface_layer_list; | 6054 LayerImplList render_surface_layer_list; |
| 6039 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 6055 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 6040 root.get(), root->bounds(), &render_surface_layer_list); | 6056 root.get(), root->bounds(), &render_surface_layer_list); |
| 6041 inputs.can_adjust_raster_scales = true; | 6057 inputs.can_adjust_raster_scales = true; |
| 6042 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 6058 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 6043 | 6059 |
| 6044 // We should have one render surface and one layers. The child has | 6060 // We should have one render surface and one layers. The child has |
| 6045 // hidden itself and the grand child. | 6061 // hidden itself and the grand child. |
| 6046 ASSERT_EQ(1u, render_surface_layer_list.size()); | 6062 ASSERT_EQ(1u, render_surface_layer_list.size()); |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6879 render_surface2->render_surface()->content_rect().ToString()); | 6895 render_surface2->render_surface()->content_rect().ToString()); |
| 6880 | 6896 |
| 6881 // Sanity check our num_unclipped_descendants values. | 6897 // Sanity check our num_unclipped_descendants values. |
| 6882 EXPECT_EQ(1, render_surface1->num_unclipped_descendants()); | 6898 EXPECT_EQ(1, render_surface1->num_unclipped_descendants()); |
| 6883 EXPECT_EQ(0, render_surface2->num_unclipped_descendants()); | 6899 EXPECT_EQ(0, render_surface2->num_unclipped_descendants()); |
| 6884 } | 6900 } |
| 6885 | 6901 |
| 6886 TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { | 6902 TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { |
| 6887 FakeImplProxy proxy; | 6903 FakeImplProxy proxy; |
| 6888 TestSharedBitmapManager shared_bitmap_manager; | 6904 TestSharedBitmapManager shared_bitmap_manager; |
| 6889 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | 6905 scoped_ptr<LayerTreeHost> host = |
| 6890 scoped_ptr<LayerImpl> root = | 6906 FakeLayerTreeHost::Create().PassAs<LayerTreeHost>(); |
| 6891 LayerImpl::Create(host_impl.active_tree(), 12345); | 6907 scoped_refptr<Layer> root = Layer::Create(); |
| 6892 scoped_ptr<LayerImpl> child1 = | 6908 root->SetLayerTreeHost(host.get()); |
| 6893 LayerImpl::Create(host_impl.active_tree(), 123456); | 6909 scoped_refptr<Layer> child1 = Layer::Create(); |
| 6894 scoped_ptr<LayerImpl> child2 = | 6910 scoped_refptr<Layer> child2 = Layer::Create(); |
| 6895 LayerImpl::Create(host_impl.active_tree(), 1234567); | 6911 scoped_refptr<Layer> child3 = Layer::Create(); |
| 6896 scoped_ptr<LayerImpl> child3 = | |
| 6897 LayerImpl::Create(host_impl.active_tree(), 12345678); | |
| 6898 | 6912 |
| 6899 gfx::Transform identity_matrix; | 6913 gfx::Transform identity_matrix; |
| 6900 gfx::Point3F transform_origin; | 6914 gfx::Point3F transform_origin; |
| 6901 gfx::PointF position; | 6915 gfx::PointF position; |
| 6902 gfx::Size bounds(100, 100); | 6916 gfx::Size bounds(100, 100); |
| 6903 SetLayerPropertiesForTesting(root.get(), | 6917 SetLayerPropertiesForTesting(root.get(), |
| 6904 identity_matrix, | 6918 identity_matrix, |
| 6905 transform_origin, | 6919 transform_origin, |
| 6906 position, | 6920 position, |
| 6907 bounds, | 6921 bounds, |
| 6908 true, | 6922 true, |
| 6909 false); | 6923 false); |
| 6910 root->SetDrawsContent(true); | 6924 root->SetIsDrawable(true); |
| 6911 | 6925 |
| 6912 // This layer structure normally forces render surface due to preserves3d | 6926 // This layer structure normally forces render surface due to preserves3d |
| 6913 // behavior. | 6927 // behavior. |
| 6914 SetLayerPropertiesForTesting(child1.get(), | 6928 SetLayerPropertiesForTesting(child1.get(), |
| 6915 identity_matrix, | 6929 identity_matrix, |
| 6916 transform_origin, | 6930 transform_origin, |
| 6917 position, | 6931 position, |
| 6918 bounds, | 6932 bounds, |
| 6919 false, | 6933 false, |
| 6920 true); | 6934 true); |
| 6921 child1->SetDrawsContent(true); | 6935 child1->SetIsDrawable(true); |
| 6922 SetLayerPropertiesForTesting(child2.get(), | 6936 SetLayerPropertiesForTesting(child2.get(), |
| 6923 identity_matrix, | 6937 identity_matrix, |
| 6924 transform_origin, | 6938 transform_origin, |
| 6925 position, | 6939 position, |
| 6926 bounds, | 6940 bounds, |
| 6927 true, | 6941 true, |
| 6928 false); | 6942 false); |
| 6929 child2->SetDrawsContent(true); | 6943 child2->SetIsDrawable(true); |
| 6930 SetLayerPropertiesForTesting(child3.get(), | 6944 SetLayerPropertiesForTesting(child3.get(), |
| 6931 identity_matrix, | 6945 identity_matrix, |
| 6932 transform_origin, | 6946 transform_origin, |
| 6933 position, | 6947 position, |
| 6934 bounds, | 6948 bounds, |
| 6935 true, | 6949 true, |
| 6936 false); | 6950 false); |
| 6937 child3->SetDrawsContent(true); | 6951 child3->SetIsDrawable(true); |
| 6938 | 6952 |
| 6939 child2->Set3dSortingContextId(1); | 6953 child2->Set3dSortingContextId(1); |
| 6940 child3->Set3dSortingContextId(1); | 6954 child3->Set3dSortingContextId(1); |
| 6941 | 6955 |
| 6942 child2->AddChild(child3.Pass()); | 6956 child2->AddChild(child3.get()); |
| 6943 child1->AddChild(child2.Pass()); | 6957 child1->AddChild(child2.get()); |
| 6944 root->AddChild(child1.Pass()); | 6958 root->AddChild(child1.get()); |
| 6945 | 6959 |
| 6946 { | 6960 { |
| 6947 LayerImplList render_surface_layer_list; | 6961 RenderSurfaceLayerList render_surface_layer_list; |
| 6948 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(root.get()); | 6962 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 6949 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | |
| 6950 root.get(), root->bounds(), &render_surface_layer_list); | 6963 root.get(), root->bounds(), &render_surface_layer_list); |
| 6951 inputs.can_render_to_separate_surface = true; | 6964 inputs.can_render_to_separate_surface = true; |
| 6952 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 6965 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 6953 | 6966 |
| 6954 EXPECT_EQ(2u, render_surface_layer_list.size()); | 6967 EXPECT_EQ(2u, render_surface_layer_list.size()); |
| 6955 } | 6968 } |
| 6956 | 6969 |
| 6957 { | 6970 { |
| 6958 LayerImplList render_surface_layer_list; | 6971 RenderSurfaceLayerList render_surface_layer_list; |
| 6959 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 6972 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 6960 root.get(), root->bounds(), &render_surface_layer_list); | 6973 root.get(), root->bounds(), &render_surface_layer_list); |
| 6961 inputs.can_render_to_separate_surface = false; | 6974 inputs.can_render_to_separate_surface = false; |
| 6962 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 6975 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 6963 | 6976 |
| 6964 EXPECT_EQ(1u, render_surface_layer_list.size()); | 6977 EXPECT_EQ(1u, render_surface_layer_list.size()); |
| 6965 } | 6978 } |
| 6979 root->SetLayerTreeHost(NULL); | |
| 6966 } | 6980 } |
| 6967 | 6981 |
| 6968 TEST_F(LayerTreeHostCommonTest, DoNotIncludeBackfaceInvisibleSurfaces) { | 6982 TEST_F(LayerTreeHostCommonTest, DoNotIncludeBackfaceInvisibleSurfaces) { |
| 6969 scoped_refptr<Layer> root = Layer::Create(); | 6983 scoped_refptr<Layer> root = Layer::Create(); |
| 6970 scoped_refptr<Layer> render_surface = Layer::Create(); | 6984 scoped_refptr<Layer> render_surface = Layer::Create(); |
| 6971 scoped_refptr<LayerWithForcedDrawsContent> child = | 6985 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 6972 make_scoped_refptr(new LayerWithForcedDrawsContent); | 6986 make_scoped_refptr(new LayerWithForcedDrawsContent); |
| 6973 | 6987 |
| 6974 root->AddChild(render_surface); | 6988 root->AddChild(render_surface); |
| 6975 render_surface->AddChild(child); | 6989 render_surface->AddChild(child); |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7574 top_transform.Translate3d(0.0, 0.0, 5.0); | 7588 top_transform.Translate3d(0.0, 0.0, 5.0); |
| 7575 gfx::Transform bottom_transform; | 7589 gfx::Transform bottom_transform; |
| 7576 bottom_transform.Translate3d(0.0, 0.0, 3.0); | 7590 bottom_transform.Translate3d(0.0, 0.0, 3.0); |
| 7577 | 7591 |
| 7578 SetLayerPropertiesForTesting(root.get(), | 7592 SetLayerPropertiesForTesting(root.get(), |
| 7579 identity_transform, | 7593 identity_transform, |
| 7580 gfx::Point3F(), | 7594 gfx::Point3F(), |
| 7581 gfx::PointF(), | 7595 gfx::PointF(), |
| 7582 gfx::Size(50, 50), | 7596 gfx::Size(50, 50), |
| 7583 true, | 7597 true, |
| 7584 false); | 7598 false, |
| 7599 true); | |
| 7585 SetLayerPropertiesForTesting(scroll_parent_border.get(), | 7600 SetLayerPropertiesForTesting(scroll_parent_border.get(), |
| 7586 identity_transform, | 7601 identity_transform, |
| 7587 gfx::Point3F(), | 7602 gfx::Point3F(), |
| 7588 gfx::PointF(), | 7603 gfx::PointF(), |
| 7589 gfx::Size(40, 40), | 7604 gfx::Size(40, 40), |
| 7590 true, | 7605 true, |
| 7606 false, | |
| 7591 false); | 7607 false); |
| 7592 SetLayerPropertiesForTesting(scroll_parent_clip.get(), | 7608 SetLayerPropertiesForTesting(scroll_parent_clip.get(), |
| 7593 identity_transform, | 7609 identity_transform, |
| 7594 gfx::Point3F(), | 7610 gfx::Point3F(), |
| 7595 gfx::PointF(), | 7611 gfx::PointF(), |
| 7596 gfx::Size(30, 30), | 7612 gfx::Size(30, 30), |
| 7597 true, | 7613 true, |
| 7614 false, | |
| 7598 false); | 7615 false); |
| 7599 SetLayerPropertiesForTesting(scroll_parent.get(), | 7616 SetLayerPropertiesForTesting(scroll_parent.get(), |
| 7600 identity_transform, | 7617 identity_transform, |
| 7601 gfx::Point3F(), | 7618 gfx::Point3F(), |
| 7602 gfx::PointF(), | 7619 gfx::PointF(), |
| 7603 gfx::Size(50, 50), | 7620 gfx::Size(50, 50), |
| 7604 true, | 7621 true, |
| 7622 true, | |
|
danakj
2014/09/03 19:30:35
this is now 3d sorted?
awoloszyn
2014/09/09 15:31:37
That was incorrect, has been fixed.
| |
| 7605 false); | 7623 false); |
| 7606 SetLayerPropertiesForTesting(scroll_child.get(), | 7624 SetLayerPropertiesForTesting(scroll_child.get(), |
| 7607 identity_transform, | 7625 identity_transform, |
| 7608 gfx::Point3F(), | 7626 gfx::Point3F(), |
| 7609 gfx::PointF(), | 7627 gfx::PointF(), |
| 7610 gfx::Size(50, 50), | 7628 gfx::Size(50, 50), |
| 7611 true, | 7629 true, |
| 7630 false, | |
| 7612 false); | 7631 false); |
| 7613 SetLayerPropertiesForTesting(top_content.get(), | 7632 SetLayerPropertiesForTesting(top_content.get(), |
| 7614 top_transform, | 7633 top_transform, |
| 7615 gfx::Point3F(), | 7634 gfx::Point3F(), |
| 7616 gfx::PointF(), | 7635 gfx::PointF(), |
| 7617 gfx::Size(50, 50), | 7636 gfx::Size(50, 50), |
| 7618 false, | 7637 false, |
| 7638 true, | |
| 7619 true); | 7639 true); |
|
danakj
2014/09/03 19:30:35
why does top/bottom content need a surface for thi
awoloszyn
2014/09/09 15:31:37
This test checks the sorted order of the created r
danakj
2014/09/25 16:02:11
From what I see it's testing the order of layers i
| |
| 7620 SetLayerPropertiesForTesting(bottom_content.get(), | 7640 SetLayerPropertiesForTesting(bottom_content.get(), |
| 7621 bottom_transform, | 7641 bottom_transform, |
| 7622 gfx::Point3F(), | 7642 gfx::Point3F(), |
| 7623 gfx::PointF(), | 7643 gfx::PointF(), |
| 7624 gfx::Size(50, 50), | 7644 gfx::Size(50, 50), |
| 7625 false, | 7645 false, |
| 7646 true, | |
| 7626 true); | 7647 true); |
| 7627 | 7648 |
| 7628 scroll_child->SetShouldFlattenTransform(false); | 7649 scroll_child->SetShouldFlattenTransform(false); |
| 7629 scroll_child->Set3dSortingContextId(1); | 7650 scroll_child->Set3dSortingContextId(1); |
| 7630 | 7651 |
| 7631 scroll_child->AddChild(top_content.Pass()); | 7652 scroll_child->AddChild(top_content.Pass()); |
| 7632 scroll_child->AddChild(bottom_content.Pass()); | 7653 scroll_child->AddChild(bottom_content.Pass()); |
| 7633 root->AddChild(scroll_child.Pass()); | 7654 root->AddChild(scroll_child.Pass()); |
| 7634 | 7655 |
| 7635 scroll_parent_clip->AddChild(scroll_parent.Pass()); | 7656 scroll_parent_clip->AddChild(scroll_parent.Pass()); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7692 gfx::Transform container_transform; | 7713 gfx::Transform container_transform; |
| 7693 container_transform.Translate3d(10.0, 20.0, 0.0); | 7714 container_transform.Translate3d(10.0, 20.0, 0.0); |
| 7694 gfx::Vector2dF container_offset = container_transform.To2dTranslation(); | 7715 gfx::Vector2dF container_offset = container_transform.To2dTranslation(); |
| 7695 | 7716 |
| 7696 SetLayerPropertiesForTesting(root.get(), | 7717 SetLayerPropertiesForTesting(root.get(), |
| 7697 identity_transform, | 7718 identity_transform, |
| 7698 gfx::Point3F(), | 7719 gfx::Point3F(), |
| 7699 gfx::PointF(), | 7720 gfx::PointF(), |
| 7700 gfx::Size(50, 50), | 7721 gfx::Size(50, 50), |
| 7701 true, | 7722 true, |
| 7702 false); | 7723 false, |
| 7724 true); | |
| 7703 SetLayerPropertiesForTesting(container.get(), | 7725 SetLayerPropertiesForTesting(container.get(), |
| 7704 container_transform, | 7726 container_transform, |
| 7705 gfx::Point3F(), | 7727 gfx::Point3F(), |
| 7706 gfx::PointF(), | 7728 gfx::PointF(), |
| 7707 gfx::Size(40, 40), | 7729 gfx::Size(40, 40), |
| 7708 true, | 7730 true, |
| 7731 false, | |
| 7709 false); | 7732 false); |
| 7710 SetLayerPropertiesForTesting(scroller.get(), | 7733 SetLayerPropertiesForTesting(scroller.get(), |
| 7711 identity_transform, | 7734 identity_transform, |
| 7712 gfx::Point3F(), | 7735 gfx::Point3F(), |
| 7713 gfx::PointF(), | 7736 gfx::PointF(), |
| 7714 gfx::Size(30, 30), | 7737 gfx::Size(30, 30), |
| 7715 true, | 7738 true, |
| 7739 false, | |
| 7716 false); | 7740 false); |
| 7717 SetLayerPropertiesForTesting(fixed.get(), | 7741 SetLayerPropertiesForTesting(fixed.get(), |
| 7718 identity_transform, | 7742 identity_transform, |
| 7719 gfx::Point3F(), | 7743 gfx::Point3F(), |
| 7720 gfx::PointF(), | 7744 gfx::PointF(), |
| 7721 gfx::Size(50, 50), | 7745 gfx::Size(50, 50), |
| 7722 true, | 7746 true, |
| 7747 false, | |
| 7723 false); | 7748 false); |
| 7724 | 7749 |
| 7725 scroller->AddChild(fixed.Pass()); | 7750 scroller->AddChild(fixed.Pass()); |
| 7726 container->AddChild(scroller.Pass()); | 7751 container->AddChild(scroller.Pass()); |
| 7727 root->AddChild(container.Pass()); | 7752 root->AddChild(container.Pass()); |
| 7728 | 7753 |
| 7729 // Rounded to integers already. | 7754 // Rounded to integers already. |
| 7730 { | 7755 { |
| 7731 gfx::Vector2dF scroll_delta(3.0, 5.0); | 7756 gfx::Vector2dF scroll_delta(3.0, 5.0); |
| 7732 scroll_layer->SetScrollDelta(scroll_delta); | 7757 scroll_layer->SetScrollDelta(scroll_delta); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7856 child->AddChild(grand_child.PassAs<LayerImpl>()); | 7881 child->AddChild(grand_child.PassAs<LayerImpl>()); |
| 7857 parent->AddChild(child.PassAs<LayerImpl>()); | 7882 parent->AddChild(child.PassAs<LayerImpl>()); |
| 7858 grand_parent->AddChild(parent.PassAs<LayerImpl>()); | 7883 grand_parent->AddChild(parent.PassAs<LayerImpl>()); |
| 7859 | 7884 |
| 7860 SetLayerPropertiesForTesting(grand_parent.get(), | 7885 SetLayerPropertiesForTesting(grand_parent.get(), |
| 7861 identity_matrix, | 7886 identity_matrix, |
| 7862 gfx::Point3F(), | 7887 gfx::Point3F(), |
| 7863 gfx::PointF(), | 7888 gfx::PointF(), |
| 7864 gfx::Size(1, 2), | 7889 gfx::Size(1, 2), |
| 7865 true, | 7890 true, |
| 7866 false); | 7891 false, |
| 7892 true); | |
| 7867 SetLayerPropertiesForTesting(parent_raw, | 7893 SetLayerPropertiesForTesting(parent_raw, |
| 7868 identity_matrix, | 7894 identity_matrix, |
| 7869 gfx::Point3F(), | 7895 gfx::Point3F(), |
| 7870 gfx::PointF(), | 7896 gfx::PointF(), |
| 7871 gfx::Size(1, 2), | 7897 gfx::Size(1, 2), |
| 7872 true, | 7898 true, |
| 7899 false, | |
| 7873 false); | 7900 false); |
| 7874 SetLayerPropertiesForTesting(child_raw, | 7901 SetLayerPropertiesForTesting(child_raw, |
| 7875 identity_matrix, | 7902 identity_matrix, |
| 7876 gfx::Point3F(), | 7903 gfx::Point3F(), |
| 7877 gfx::PointF(), | 7904 gfx::PointF(), |
| 7878 gfx::Size(1, 2), | 7905 gfx::Size(1, 2), |
| 7879 true, | 7906 true, |
| 7907 false, | |
| 7880 false); | 7908 false); |
| 7909 | |
| 7881 SetLayerPropertiesForTesting(grand_child_raw, | 7910 SetLayerPropertiesForTesting(grand_child_raw, |
| 7882 identity_matrix, | 7911 identity_matrix, |
| 7883 gfx::Point3F(), | 7912 gfx::Point3F(), |
| 7884 gfx::PointF(), | 7913 gfx::PointF(), |
| 7885 gfx::Size(1, 2), | 7914 gfx::Size(1, 2), |
| 7886 true, | 7915 true, |
| 7916 false, | |
| 7887 false); | 7917 false); |
| 7888 | 7918 |
| 7889 ExecuteCalculateDrawProperties(grand_parent.get()); | 7919 ExecuteCalculateDrawProperties(grand_parent.get()); |
| 7890 | 7920 |
| 7891 // No layers have animations. | 7921 // No layers have animations. |
| 7892 EXPECT_EQ(0.f, | 7922 EXPECT_EQ(0.f, |
| 7893 grand_parent->draw_properties().maximum_animation_contents_scale); | 7923 grand_parent->draw_properties().maximum_animation_contents_scale); |
| 7894 EXPECT_EQ(0.f, | 7924 EXPECT_EQ(0.f, |
| 7895 parent_raw->draw_properties().maximum_animation_contents_scale); | 7925 parent_raw->draw_properties().maximum_animation_contents_scale); |
| 7896 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); | 7926 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8092 child->AddChild(grand_child2.Pass()); | 8122 child->AddChild(grand_child2.Pass()); |
| 8093 parent->AddChild(child.Pass()); | 8123 parent->AddChild(child.Pass()); |
| 8094 grand_parent->AddChild(parent.Pass()); | 8124 grand_parent->AddChild(parent.Pass()); |
| 8095 | 8125 |
| 8096 SetLayerPropertiesForTesting(grand_parent_raw, | 8126 SetLayerPropertiesForTesting(grand_parent_raw, |
| 8097 identity_matrix, | 8127 identity_matrix, |
| 8098 gfx::Point3F(), | 8128 gfx::Point3F(), |
| 8099 gfx::PointF(), | 8129 gfx::PointF(), |
| 8100 gfx::Size(1, 2), | 8130 gfx::Size(1, 2), |
| 8101 true, | 8131 true, |
| 8102 false); | 8132 false, |
| 8133 true); | |
| 8103 SetLayerPropertiesForTesting(parent_raw, | 8134 SetLayerPropertiesForTesting(parent_raw, |
| 8104 identity_matrix, | 8135 identity_matrix, |
| 8105 gfx::Point3F(), | 8136 gfx::Point3F(), |
| 8106 gfx::PointF(), | 8137 gfx::PointF(), |
| 8107 gfx::Size(1, 2), | 8138 gfx::Size(1, 2), |
| 8108 true, | 8139 true, |
| 8140 false, | |
| 8109 false); | 8141 false); |
| 8142 | |
| 8110 SetLayerPropertiesForTesting(child_raw, | 8143 SetLayerPropertiesForTesting(child_raw, |
| 8111 identity_matrix, | 8144 identity_matrix, |
| 8112 gfx::Point3F(), | 8145 gfx::Point3F(), |
| 8113 gfx::PointF(), | 8146 gfx::PointF(), |
| 8114 gfx::Size(1, 2), | 8147 gfx::Size(1, 2), |
| 8115 true, | 8148 true, |
| 8149 false, | |
| 8116 false); | 8150 false); |
| 8151 | |
| 8117 SetLayerPropertiesForTesting(grand_child1_raw, | 8152 SetLayerPropertiesForTesting(grand_child1_raw, |
| 8118 identity_matrix, | 8153 identity_matrix, |
| 8119 gfx::Point3F(), | 8154 gfx::Point3F(), |
| 8120 gfx::PointF(), | 8155 gfx::PointF(), |
| 8121 gfx::Size(1, 2), | 8156 gfx::Size(1, 2), |
| 8122 true, | 8157 true, |
| 8158 false, | |
| 8123 false); | 8159 false); |
| 8160 | |
| 8124 SetLayerPropertiesForTesting(grand_child2_raw, | 8161 SetLayerPropertiesForTesting(grand_child2_raw, |
| 8125 identity_matrix, | 8162 identity_matrix, |
| 8126 gfx::Point3F(), | 8163 gfx::Point3F(), |
| 8127 gfx::PointF(), | 8164 gfx::PointF(), |
| 8128 gfx::Size(1, 2), | 8165 gfx::Size(1, 2), |
| 8129 true, | 8166 true, |
| 8167 false, | |
| 8130 false); | 8168 false); |
| 8131 | 8169 |
| 8132 // Start with nothing being drawn. | 8170 // Start with nothing being drawn. |
| 8133 ExecuteCalculateDrawProperties(grand_parent_raw); | 8171 ExecuteCalculateDrawProperties(grand_parent_raw); |
| 8134 int member_id = render_surface_layer_list_count(); | 8172 int member_id = render_surface_layer_list_count(); |
| 8135 | 8173 |
| 8136 EXPECT_NE(member_id, membership_id(grand_parent_raw)); | 8174 EXPECT_NE(member_id, membership_id(grand_parent_raw)); |
| 8137 EXPECT_NE(member_id, membership_id(parent_raw)); | 8175 EXPECT_NE(member_id, membership_id(parent_raw)); |
| 8138 EXPECT_NE(member_id, membership_id(child_raw)); | 8176 EXPECT_NE(member_id, membership_id(child_raw)); |
| 8139 EXPECT_NE(member_id, membership_id(grand_child1_raw)); | 8177 EXPECT_NE(member_id, membership_id(grand_child1_raw)); |
| 8140 EXPECT_NE(member_id, membership_id(grand_child2_raw)); | 8178 EXPECT_NE(member_id, membership_id(grand_child2_raw)); |
| 8141 | 8179 |
| 8142 std::set<LayerImpl*> expected; | 8180 std::set<LayerImpl*> expected; |
| 8143 std::set<LayerImpl*> actual; | 8181 std::set<LayerImpl*> actual; |
| 8144 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); | 8182 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); |
| 8145 EXPECT_EQ(expected, actual); | 8183 EXPECT_EQ(expected, actual); |
| 8146 | 8184 |
| 8147 // If we force render surface, but none of the layers are in the layer list, | 8185 // If we force render surface, but none of the layers are in the layer list, |
| 8148 // then this layer should not appear in RSLL. | 8186 // then this layer should not appear in RSLL. |
| 8149 grand_child1_raw->SetForceRenderSurface(true); | 8187 grand_child1_raw->SetHasRenderSurface(true); |
| 8150 | 8188 |
| 8151 ExecuteCalculateDrawProperties(grand_parent_raw); | 8189 ExecuteCalculateDrawProperties(grand_parent_raw); |
| 8152 member_id = render_surface_layer_list_count(); | 8190 member_id = render_surface_layer_list_count(); |
| 8153 | 8191 |
| 8154 EXPECT_NE(member_id, membership_id(grand_parent_raw)); | 8192 EXPECT_NE(member_id, membership_id(grand_parent_raw)); |
| 8155 EXPECT_NE(member_id, membership_id(parent_raw)); | 8193 EXPECT_NE(member_id, membership_id(parent_raw)); |
| 8156 EXPECT_NE(member_id, membership_id(child_raw)); | 8194 EXPECT_NE(member_id, membership_id(child_raw)); |
| 8157 EXPECT_NE(member_id, membership_id(grand_child1_raw)); | 8195 EXPECT_NE(member_id, membership_id(grand_child1_raw)); |
| 8158 EXPECT_NE(member_id, membership_id(grand_child2_raw)); | 8196 EXPECT_NE(member_id, membership_id(grand_child2_raw)); |
| 8159 | 8197 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 8178 expected.clear(); | 8216 expected.clear(); |
| 8179 expected.insert(grand_child1_raw); | 8217 expected.insert(grand_child1_raw); |
| 8180 | 8218 |
| 8181 actual.clear(); | 8219 actual.clear(); |
| 8182 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); | 8220 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); |
| 8183 EXPECT_EQ(expected, actual); | 8221 EXPECT_EQ(expected, actual); |
| 8184 | 8222 |
| 8185 // Now child is forced to have a render surface, and one if its children draws | 8223 // Now child is forced to have a render surface, and one if its children draws |
| 8186 // content. | 8224 // content. |
| 8187 grand_child1_raw->SetDrawsContent(false); | 8225 grand_child1_raw->SetDrawsContent(false); |
| 8188 grand_child1_raw->SetForceRenderSurface(false); | 8226 grand_child1_raw->SetHasRenderSurface(false); |
| 8189 child_raw->SetForceRenderSurface(true); | 8227 child_raw->SetHasRenderSurface(true); |
| 8190 grand_child2_raw->SetDrawsContent(true); | 8228 grand_child2_raw->SetDrawsContent(true); |
| 8191 | 8229 |
| 8192 ExecuteCalculateDrawProperties(grand_parent_raw); | 8230 ExecuteCalculateDrawProperties(grand_parent_raw); |
| 8193 member_id = render_surface_layer_list_count(); | 8231 member_id = render_surface_layer_list_count(); |
| 8194 | 8232 |
| 8195 EXPECT_NE(member_id, membership_id(grand_parent_raw)); | 8233 EXPECT_NE(member_id, membership_id(grand_parent_raw)); |
| 8196 EXPECT_NE(member_id, membership_id(parent_raw)); | 8234 EXPECT_NE(member_id, membership_id(parent_raw)); |
| 8197 EXPECT_NE(member_id, membership_id(child_raw)); | 8235 EXPECT_NE(member_id, membership_id(child_raw)); |
| 8198 EXPECT_NE(member_id, membership_id(grand_child1_raw)); | 8236 EXPECT_NE(member_id, membership_id(grand_child1_raw)); |
| 8199 EXPECT_EQ(member_id, membership_id(grand_child2_raw)); | 8237 EXPECT_EQ(member_id, membership_id(grand_child2_raw)); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8346 scale_transform_child2; | 8384 scale_transform_child2; |
| 8347 scale_transform_child1.Scale(2, 3); | 8385 scale_transform_child1.Scale(2, 3); |
| 8348 scale_transform_child2.Scale(4, 5); | 8386 scale_transform_child2.Scale(4, 5); |
| 8349 | 8387 |
| 8350 SetLayerPropertiesForTesting(root_layer, | 8388 SetLayerPropertiesForTesting(root_layer, |
| 8351 identity_matrix, | 8389 identity_matrix, |
| 8352 gfx::Point3F(), | 8390 gfx::Point3F(), |
| 8353 gfx::PointF(), | 8391 gfx::PointF(), |
| 8354 gfx::Size(1, 1), | 8392 gfx::Size(1, 1), |
| 8355 true, | 8393 true, |
| 8356 false); | 8394 false, |
| 8395 true); | |
| 8357 SetLayerPropertiesForTesting(child1_layer, | 8396 SetLayerPropertiesForTesting(child1_layer, |
| 8358 scale_transform_child1, | 8397 scale_transform_child1, |
| 8359 gfx::Point3F(), | 8398 gfx::Point3F(), |
| 8360 gfx::PointF(), | 8399 gfx::PointF(), |
| 8361 gfx::Size(), | 8400 gfx::Size(), |
| 8362 true, | 8401 true, |
| 8402 false, | |
| 8363 false); | 8403 false); |
| 8364 | 8404 |
| 8365 child1_layer->SetMaskLayer( | 8405 child1_layer->SetMaskLayer( |
| 8366 LayerImpl::Create(host_impl.active_tree(), 4).Pass()); | 8406 LayerImpl::Create(host_impl.active_tree(), 4).Pass()); |
| 8367 | 8407 |
| 8368 scoped_ptr<LayerImpl> replica_layer = | 8408 scoped_ptr<LayerImpl> replica_layer = |
| 8369 LayerImpl::Create(host_impl.active_tree(), 5); | 8409 LayerImpl::Create(host_impl.active_tree(), 5); |
| 8370 replica_layer->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 6)); | 8410 replica_layer->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 6)); |
| 8371 child1_layer->SetReplicaLayer(replica_layer.Pass()); | 8411 child1_layer->SetReplicaLayer(replica_layer.Pass()); |
| 8372 | 8412 |
| 8373 ExecuteCalculateDrawProperties(root_layer); | 8413 ExecuteCalculateDrawProperties(root_layer); |
| 8374 | 8414 |
| 8375 TransformOperations scale; | 8415 TransformOperations scale; |
| 8376 scale.AppendScale(5.f, 8.f, 3.f); | 8416 scale.AppendScale(5.f, 8.f, 3.f); |
| 8377 | 8417 |
| 8378 AddAnimatedTransformToLayer(child2_layer, 1.0, TransformOperations(), scale); | 8418 AddAnimatedTransformToLayer(child2_layer, 1.0, TransformOperations(), scale); |
| 8379 SetLayerPropertiesForTesting(child2_layer, | 8419 SetLayerPropertiesForTesting(child2_layer, |
| 8380 scale_transform_child2, | 8420 scale_transform_child2, |
| 8381 gfx::Point3F(), | 8421 gfx::Point3F(), |
| 8382 gfx::PointF(), | 8422 gfx::PointF(), |
| 8383 gfx::Size(), | 8423 gfx::Size(), |
| 8384 true, | 8424 true, |
| 8425 false, | |
| 8385 false); | 8426 false); |
| 8386 | 8427 |
| 8387 ExecuteCalculateDrawProperties(root_layer); | 8428 ExecuteCalculateDrawProperties(root_layer); |
| 8388 | 8429 |
| 8389 EXPECT_FLOAT_EQ(1.f, root_layer->draw_properties().ideal_contents_scale); | 8430 EXPECT_FLOAT_EQ(1.f, root_layer->draw_properties().ideal_contents_scale); |
| 8390 EXPECT_FLOAT_EQ(3.f, child1_layer->draw_properties().ideal_contents_scale); | 8431 EXPECT_FLOAT_EQ(3.f, child1_layer->draw_properties().ideal_contents_scale); |
| 8391 EXPECT_FLOAT_EQ( | 8432 EXPECT_FLOAT_EQ( |
| 8392 3.f, child1_layer->mask_layer()->draw_properties().ideal_contents_scale); | 8433 3.f, child1_layer->mask_layer()->draw_properties().ideal_contents_scale); |
| 8393 EXPECT_FLOAT_EQ(3.f, | 8434 EXPECT_FLOAT_EQ(3.f, |
| 8394 child1_layer->replica_layer() | 8435 child1_layer->replica_layer() |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8554 EXPECT_FLOAT_EQ(4.f, | 8595 EXPECT_FLOAT_EQ(4.f, |
| 8555 child1_layer->replica_layer() | 8596 child1_layer->replica_layer() |
| 8556 ->mask_layer() | 8597 ->mask_layer() |
| 8557 ->draw_properties() | 8598 ->draw_properties() |
| 8558 .device_scale_factor); | 8599 .device_scale_factor); |
| 8559 EXPECT_FLOAT_EQ(4.f, child2_layer->draw_properties().device_scale_factor); | 8600 EXPECT_FLOAT_EQ(4.f, child2_layer->draw_properties().device_scale_factor); |
| 8560 } | 8601 } |
| 8561 | 8602 |
| 8562 } // namespace | 8603 } // namespace |
| 8563 } // namespace cc | 8604 } // namespace cc |
| OLD | NEW |