Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 2885953002: cc : Fix axis alignment tracking bug in property tree building (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cc/trees/property_tree_builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | cc/trees/property_tree_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698