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 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1334 draws_content->SetBounds(gfx::Size(10, 10)); | 1334 draws_content->SetBounds(gfx::Size(10, 10)); |
1335 draws_content->SetDrawsContent(true); | 1335 draws_content->SetDrawsContent(true); |
1336 | 1336 |
1337 ExecuteCalculateDrawProperties(root); | 1337 ExecuteCalculateDrawProperties(root); |
1338 EffectTree& effect_tree = | 1338 EffectTree& effect_tree = |
1339 root->layer_tree_impl()->property_trees()->effect_tree; | 1339 root->layer_tree_impl()->property_trees()->effect_tree; |
1340 EffectNode* node = effect_tree.Node(clips_subtree->effect_tree_index()); | 1340 EffectNode* node = effect_tree.Node(clips_subtree->effect_tree_index()); |
1341 EXPECT_TRUE(node->has_render_surface); | 1341 EXPECT_TRUE(node->has_render_surface); |
1342 } | 1342 } |
1343 | 1343 |
| 1344 TEST_F(LayerTreeHostCommonTest, EffectNodesForNonAxisAlignedClips) { |
| 1345 LayerImpl* root = root_layer_for_testing(); |
| 1346 LayerImpl* rotate_and_clip = AddChildToRoot<LayerImpl>(); |
| 1347 LayerImpl* only_clip = AddChild<LayerImpl>(rotate_and_clip); |
| 1348 LayerImpl* rotate_and_clip2 = AddChild<LayerImpl>(only_clip); |
| 1349 |
| 1350 gfx::Transform rotate; |
| 1351 rotate.Rotate(2); |
| 1352 root->SetBounds(gfx::Size(10, 10)); |
| 1353 rotate_and_clip->SetBounds(gfx::Size(10, 10)); |
| 1354 rotate_and_clip->test_properties()->transform = rotate; |
| 1355 rotate_and_clip->SetMasksToBounds(true); |
| 1356 only_clip->SetBounds(gfx::Size(10, 10)); |
| 1357 only_clip->SetMasksToBounds(true); |
| 1358 rotate_and_clip2->SetBounds(gfx::Size(10, 10)); |
| 1359 rotate_and_clip2->test_properties()->transform = rotate; |
| 1360 rotate_and_clip2->SetMasksToBounds(true); |
| 1361 |
| 1362 ExecuteCalculateDrawProperties(root); |
| 1363 // non-axis aligned clip should create an effect node |
| 1364 EXPECT_NE(root->effect_tree_index(), rotate_and_clip->effect_tree_index()); |
| 1365 // Since only_clip's clip is in the same non-axis aligned space as |
| 1366 // rotate_and_clip's clip, no new effect node should be created. |
| 1367 EXPECT_EQ(rotate_and_clip->effect_tree_index(), |
| 1368 only_clip->effect_tree_index()); |
| 1369 // rotate_and_clip2's clip and only_clip's clip are in different non-axis |
| 1370 // aligned spaces. So, new effect node should be created. |
| 1371 EXPECT_NE(rotate_and_clip2->effect_tree_index(), |
| 1372 only_clip->effect_tree_index()); |
| 1373 } |
| 1374 |
1344 TEST_F(LayerTreeHostCommonTest, | 1375 TEST_F(LayerTreeHostCommonTest, |
1345 RenderSurfaceListForRenderSurfaceWithClippedLayer) { | 1376 RenderSurfaceListForRenderSurfaceWithClippedLayer) { |
1346 LayerImpl* root = root_layer_for_testing(); | 1377 LayerImpl* root = root_layer_for_testing(); |
1347 LayerImpl* render_surface1 = AddChildToRoot<LayerImpl>(); | 1378 LayerImpl* render_surface1 = AddChildToRoot<LayerImpl>(); |
1348 LayerImpl* child = AddChild<LayerImpl>(render_surface1); | 1379 LayerImpl* child = AddChild<LayerImpl>(render_surface1); |
1349 | 1380 |
1350 root->SetBounds(gfx::Size(10, 10)); | 1381 root->SetBounds(gfx::Size(10, 10)); |
1351 root->SetMasksToBounds(true); | 1382 root->SetMasksToBounds(true); |
1352 render_surface1->SetBounds(gfx::Size(10, 10)); | 1383 render_surface1->SetBounds(gfx::Size(10, 10)); |
1353 render_surface1->test_properties()->force_render_surface = true; | 1384 render_surface1->test_properties()->force_render_surface = true; |
(...skipping 8824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10178 | 10209 |
10179 // Check child layer draw properties. | 10210 // Check child layer draw properties. |
10180 EXPECT_EQ(gfx::Rect(10, 10), child->visible_layer_rect()); | 10211 EXPECT_EQ(gfx::Rect(10, 10), child->visible_layer_rect()); |
10181 EXPECT_EQ(gfx::Transform(), child->DrawTransform()); | 10212 EXPECT_EQ(gfx::Transform(), child->DrawTransform()); |
10182 EXPECT_EQ(gfx::Rect(10, 10), child->clip_rect()); | 10213 EXPECT_EQ(gfx::Rect(10, 10), child->clip_rect()); |
10183 EXPECT_EQ(gfx::Rect(10, 10), child->drawable_content_rect()); | 10214 EXPECT_EQ(gfx::Rect(10, 10), child->drawable_content_rect()); |
10184 } | 10215 } |
10185 | 10216 |
10186 } // namespace | 10217 } // namespace |
10187 } // namespace cc | 10218 } // namespace cc |
OLD | NEW |