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 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 EXPECT_TRANSFORMATION_MATRIX_EQ( | 1310 EXPECT_TRANSFORMATION_MATRIX_EQ( |
1311 compositeSquared, child->draw_properties().target_space_transform); | 1311 compositeSquared, child->draw_properties().target_space_transform); |
1312 EXPECT_TRANSFORMATION_MATRIX_EQ(gfx::Transform(), | 1312 EXPECT_TRANSFORMATION_MATRIX_EQ(gfx::Transform(), |
1313 GetRenderSurface(root)->draw_transform()); | 1313 GetRenderSurface(root)->draw_transform()); |
1314 EXPECT_TRANSFORMATION_MATRIX_EQ(compositeSquared, | 1314 EXPECT_TRANSFORMATION_MATRIX_EQ(compositeSquared, |
1315 child->ScreenSpaceTransform()); | 1315 child->ScreenSpaceTransform()); |
1316 EXPECT_EQ(gfx::Rect(254, 316, 428, 428), child->clip_rect()); | 1316 EXPECT_EQ(gfx::Rect(254, 316, 428, 428), child->clip_rect()); |
1317 } | 1317 } |
1318 } | 1318 } |
1319 | 1319 |
| 1320 TEST_F(LayerTreeHostCommonTest, RenderSurfaceForNonAxisAlignedClipping) { |
| 1321 LayerImpl* root = root_layer_for_testing(); |
| 1322 LayerImpl* rotated_and_transparent = AddChildToRoot<LayerImpl>(); |
| 1323 LayerImpl* clips_subtree = AddChild<LayerImpl>(rotated_and_transparent); |
| 1324 LayerImpl* draws_content = AddChild<LayerImpl>(clips_subtree); |
| 1325 |
| 1326 root->SetBounds(gfx::Size(10, 10)); |
| 1327 rotated_and_transparent->SetBounds(gfx::Size(10, 10)); |
| 1328 rotated_and_transparent->test_properties()->opacity = 0.5f; |
| 1329 gfx::Transform rotate; |
| 1330 rotate.Rotate(2); |
| 1331 rotated_and_transparent->test_properties()->transform = rotate; |
| 1332 clips_subtree->SetBounds(gfx::Size(10, 10)); |
| 1333 clips_subtree->SetMasksToBounds(true); |
| 1334 draws_content->SetBounds(gfx::Size(10, 10)); |
| 1335 draws_content->SetDrawsContent(true); |
| 1336 |
| 1337 ExecuteCalculateDrawProperties(root); |
| 1338 EffectTree& effect_tree = |
| 1339 root->layer_tree_impl()->property_trees()->effect_tree; |
| 1340 EffectNode* node = effect_tree.Node(clips_subtree->effect_tree_index()); |
| 1341 EXPECT_TRUE(node->has_render_surface); |
| 1342 } |
| 1343 |
1320 TEST_F(LayerTreeHostCommonTest, | 1344 TEST_F(LayerTreeHostCommonTest, |
1321 RenderSurfaceListForRenderSurfaceWithClippedLayer) { | 1345 RenderSurfaceListForRenderSurfaceWithClippedLayer) { |
1322 LayerImpl* root = root_layer_for_testing(); | 1346 LayerImpl* root = root_layer_for_testing(); |
1323 LayerImpl* render_surface1 = AddChildToRoot<LayerImpl>(); | 1347 LayerImpl* render_surface1 = AddChildToRoot<LayerImpl>(); |
1324 LayerImpl* child = AddChild<LayerImpl>(render_surface1); | 1348 LayerImpl* child = AddChild<LayerImpl>(render_surface1); |
1325 | 1349 |
1326 root->SetBounds(gfx::Size(10, 10)); | 1350 root->SetBounds(gfx::Size(10, 10)); |
1327 root->SetMasksToBounds(true); | 1351 root->SetMasksToBounds(true); |
1328 render_surface1->SetBounds(gfx::Size(10, 10)); | 1352 render_surface1->SetBounds(gfx::Size(10, 10)); |
1329 render_surface1->test_properties()->force_render_surface = true; | 1353 render_surface1->test_properties()->force_render_surface = true; |
(...skipping 8794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10124 | 10148 |
10125 // Check child layer draw properties. | 10149 // Check child layer draw properties. |
10126 EXPECT_EQ(gfx::Rect(10, 10), child->visible_layer_rect()); | 10150 EXPECT_EQ(gfx::Rect(10, 10), child->visible_layer_rect()); |
10127 EXPECT_EQ(gfx::Transform(), child->DrawTransform()); | 10151 EXPECT_EQ(gfx::Transform(), child->DrawTransform()); |
10128 EXPECT_EQ(gfx::Rect(10, 10), child->clip_rect()); | 10152 EXPECT_EQ(gfx::Rect(10, 10), child->clip_rect()); |
10129 EXPECT_EQ(gfx::Rect(10, 10), child->drawable_content_rect()); | 10153 EXPECT_EQ(gfx::Rect(10, 10), child->drawable_content_rect()); |
10130 } | 10154 } |
10131 | 10155 |
10132 } // namespace | 10156 } // namespace |
10133 } // namespace cc | 10157 } // namespace cc |
OLD | NEW |