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 <set> | 10 #include <set> |
(...skipping 6372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6383 EXPECT_EQ(1, count_represents_target_render_surface); | 6383 EXPECT_EQ(1, count_represents_target_render_surface); |
6384 // No layer contributes a render surface to root render surface. | 6384 // No layer contributes a render surface to root render surface. |
6385 EXPECT_EQ(0, count_represents_contributing_render_surface); | 6385 EXPECT_EQ(0, count_represents_contributing_render_surface); |
6386 // All 4 layers represent itself. | 6386 // All 4 layers represent itself. |
6387 EXPECT_EQ(4, count_represents_itself); | 6387 EXPECT_EQ(4, count_represents_itself); |
6388 } | 6388 } |
6389 } | 6389 } |
6390 | 6390 |
6391 TEST_F(LayerTreeHostCommonTest, DoNotIncludeBackfaceInvisibleSurfaces) { | 6391 TEST_F(LayerTreeHostCommonTest, DoNotIncludeBackfaceInvisibleSurfaces) { |
6392 LayerImpl* root = root_layer(); | 6392 LayerImpl* root = root_layer(); |
6393 LayerImpl* render_surface = AddChild<LayerImpl>(root); | 6393 LayerImpl* back_facing = AddChild<LayerImpl>(root); |
6394 LayerImpl* child = AddChild<LayerImpl>(render_surface); | 6394 LayerImpl* render_surface1 = AddChild<LayerImpl>(back_facing); |
6395 child->SetDrawsContent(true); | 6395 LayerImpl* render_surface2 = AddChild<LayerImpl>(back_facing); |
6396 LayerImpl* child1 = AddChild<LayerImpl>(render_surface1); | |
6397 LayerImpl* child2 = AddChild<LayerImpl>(render_surface2); | |
6398 child1->SetDrawsContent(true); | |
6399 child2->SetDrawsContent(true); | |
6396 | 6400 |
6397 gfx::Transform identity_transform; | 6401 gfx::Transform identity_transform; |
6398 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(), | 6402 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(), |
6399 gfx::PointF(), gfx::Size(50, 50), true, false, | 6403 gfx::PointF(), gfx::Size(50, 50), true, false, |
6400 true); | 6404 true); |
6401 SetLayerPropertiesForTesting(render_surface, identity_transform, | 6405 SetLayerPropertiesForTesting(back_facing, identity_transform, gfx::Point3F(), |
6406 gfx::PointF(), gfx::Size(50, 50), true, false, | |
6407 false); | |
6408 SetLayerPropertiesForTesting(render_surface1, identity_transform, | |
6402 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), | 6409 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), |
6403 false, true, true); | 6410 false, true, true); |
6404 SetLayerPropertiesForTesting(child, identity_transform, gfx::Point3F(), | 6411 SetLayerPropertiesForTesting(render_surface2, identity_transform, |
6412 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), | |
6413 false, true, true); | |
6414 SetLayerPropertiesForTesting(child1, identity_transform, gfx::Point3F(), | |
6415 gfx::PointF(), gfx::Size(20, 20), true, false, | |
6416 false); | |
6417 SetLayerPropertiesForTesting(child2, identity_transform, gfx::Point3F(), | |
6405 gfx::PointF(), gfx::Size(20, 20), true, false, | 6418 gfx::PointF(), gfx::Size(20, 20), true, false, |
6406 false); | 6419 false); |
6407 | 6420 |
6408 root->SetShouldFlattenTransform(false); | 6421 root->SetShouldFlattenTransform(false); |
6409 root->Set3dSortingContextId(1); | 6422 root->Set3dSortingContextId(1); |
6410 render_surface->SetDoubleSided(false); | 6423 back_facing->Set3dSortingContextId(1); |
6424 back_facing->SetShouldFlattenTransform(false); | |
6425 render_surface1->SetDoubleSided(false); | |
6426 render_surface2->Set3dSortingContextId(2); | |
6427 render_surface2->SetDoubleSided(false); | |
6411 | 6428 |
6412 ExecuteCalculateDrawProperties(root); | 6429 ExecuteCalculateDrawProperties(root); |
6413 | 6430 |
6414 EXPECT_EQ(2u, render_surface_layer_list_impl()->size()); | 6431 EXPECT_EQ(render_surface1->sorting_context_id(), root->sorting_context_id()); |
6415 EXPECT_EQ(1u, render_surface_layer_list_impl() | 6432 EXPECT_NE(render_surface2->sorting_context_id(), root->sorting_context_id()); |
6433 EXPECT_EQ(3u, render_surface_layer_list_impl()->size()); | |
6434 EXPECT_EQ(2u, render_surface_layer_list_impl() | |
6416 ->at(0) | 6435 ->at(0) |
6417 ->render_surface() | 6436 ->render_surface() |
6418 ->layer_list() | 6437 ->layer_list() |
6419 .size()); | 6438 .size()); |
6420 EXPECT_EQ(1u, render_surface_layer_list_impl() | 6439 EXPECT_EQ(1u, render_surface_layer_list_impl() |
6421 ->at(1) | 6440 ->at(1) |
6422 ->render_surface() | 6441 ->render_surface() |
6423 ->layer_list() | 6442 ->layer_list() |
6424 .size()); | 6443 .size()); |
6425 | 6444 |
6426 gfx::Transform rotation_transform = identity_transform; | 6445 gfx::Transform rotation_transform = identity_transform; |
6427 rotation_transform.RotateAboutXAxis(180.0); | 6446 rotation_transform.RotateAboutXAxis(180.0); |
6428 | 6447 |
6429 render_surface->SetTransform(rotation_transform); | 6448 back_facing->SetTransform(rotation_transform); |
6430 root->layer_tree_impl()->property_trees()->needs_rebuild = true; | 6449 root->layer_tree_impl()->property_trees()->needs_rebuild = true; |
6431 | 6450 |
6432 ExecuteCalculateDrawProperties(root); | 6451 ExecuteCalculateDrawProperties(root); |
6433 | 6452 |
6434 EXPECT_EQ(1u, render_surface_layer_list_impl()->size()); | 6453 // render_surface1 is in the same 3d rendering context as back_facing and is |
6435 EXPECT_EQ(0u, render_surface_layer_list_impl() | 6454 // not double sided, so it should not be in RSLL. render_surface2 is also not |
6455 // double-sided, but will still be in RSLL as its in a differnt 3d rendering | |
ajuma
2016/01/28 00:08:35
typos: "it's" and "different"
| |
6456 // context. | |
6457 EXPECT_EQ(2u, render_surface_layer_list_impl()->size()); | |
6458 EXPECT_EQ(1u, render_surface_layer_list_impl() | |
6436 ->at(0) | 6459 ->at(0) |
6437 ->render_surface() | 6460 ->render_surface() |
6438 ->layer_list() | 6461 ->layer_list() |
6439 .size()); | 6462 .size()); |
6440 } | 6463 } |
6441 | 6464 |
6442 TEST_F(LayerTreeHostCommonTest, DoNotIncludeBackfaceInvisibleLayers) { | 6465 TEST_F(LayerTreeHostCommonTest, DoNotIncludeBackfaceInvisibleLayers) { |
6443 LayerImpl* root = root_layer(); | 6466 LayerImpl* root = root_layer(); |
6444 LayerImpl* child = AddChild<LayerImpl>(root); | 6467 LayerImpl* child = AddChild<LayerImpl>(root); |
6445 LayerImpl* grand_child = AddChild<LayerImpl>(child); | 6468 LayerImpl* grand_child = AddChild<LayerImpl>(child); |
(...skipping 3386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9832 proto::ScrollAndScaleSet proto; | 9855 proto::ScrollAndScaleSet proto; |
9833 scroll_and_scale_set.ToProtobuf(&proto); | 9856 scroll_and_scale_set.ToProtobuf(&proto); |
9834 ScrollAndScaleSet new_scroll_and_scale_set; | 9857 ScrollAndScaleSet new_scroll_and_scale_set; |
9835 new_scroll_and_scale_set.FromProtobuf(proto); | 9858 new_scroll_and_scale_set.FromProtobuf(proto); |
9836 | 9859 |
9837 EXPECT_TRUE(scroll_and_scale_set.EqualsForTesting(new_scroll_and_scale_set)); | 9860 EXPECT_TRUE(scroll_and_scale_set.EqualsForTesting(new_scroll_and_scale_set)); |
9838 } | 9861 } |
9839 | 9862 |
9840 } // namespace | 9863 } // namespace |
9841 } // namespace cc | 9864 } // namespace cc |
OLD | NEW |