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

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

Issue 2448403002: cc: Clean up transform tree (Closed)
Patch Set: PAC Created 4 years, 1 month 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 | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_host_impl_unittest.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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 root_layer->GetLayerTree()->property_trees(); 206 root_layer->GetLayerTree()->property_trees();
207 update_layer_list_.clear(); 207 update_layer_list_.clear();
208 PropertyTreeBuilder::BuildPropertyTrees( 208 PropertyTreeBuilder::BuildPropertyTrees(
209 root_layer, page_scale_layer, inner_viewport_scroll_layer, 209 root_layer, page_scale_layer, inner_viewport_scroll_layer,
210 outer_viewport_scroll_layer, overscroll_elasticity_layer, 210 outer_viewport_scroll_layer, overscroll_elasticity_layer,
211 elastic_overscroll, page_scale_factor, device_scale_factor, 211 elastic_overscroll, page_scale_factor, device_scale_factor,
212 gfx::Rect(device_viewport_size), gfx::Transform(), property_trees); 212 gfx::Rect(device_viewport_size), gfx::Transform(), property_trees);
213 draw_property_utils::UpdatePropertyTrees(property_trees, 213 draw_property_utils::UpdatePropertyTrees(property_trees,
214 can_render_to_separate_surface); 214 can_render_to_separate_surface);
215 draw_property_utils::FindLayersThatNeedUpdates( 215 draw_property_utils::FindLayersThatNeedUpdates(
216 root_layer->GetLayerTree(), property_trees->transform_tree, 216 root_layer->GetLayerTree(), property_trees, &update_layer_list_);
217 property_trees->effect_tree, &update_layer_list_);
218 } 217 }
219 218
220 void ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList( 219 void ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(
221 LayerImpl* root_layer, 220 LayerImpl* root_layer,
222 bool skip_verify_visible_rect_calculations = false) { 221 bool skip_verify_visible_rect_calculations = false) {
223 DCHECK(root_layer->layer_tree_impl()); 222 DCHECK(root_layer->layer_tree_impl());
224 PropertyTreeBuilder::PreCalculateMetaInformationForTesting(root_layer); 223 PropertyTreeBuilder::PreCalculateMetaInformationForTesting(root_layer);
225 224
226 bool can_render_to_separate_surface = true; 225 bool can_render_to_separate_surface = true;
227 226
(...skipping 9659 matching lines...) Expand 10 before | Expand all | Expand 10 after
9887 root->SetBounds(gfx::Size(30, 30)); 9886 root->SetBounds(gfx::Size(30, 30));
9888 render_surface1->test_properties()->transform = scale; 9887 render_surface1->test_properties()->transform = scale;
9889 render_surface1->SetBounds(gfx::Size(30, 30)); 9888 render_surface1->SetBounds(gfx::Size(30, 30));
9890 render_surface1->test_properties()->force_render_surface = true; 9889 render_surface1->test_properties()->force_render_surface = true;
9891 between_targets->SetBounds(gfx::Size(30, 30)); 9890 between_targets->SetBounds(gfx::Size(30, 30));
9892 render_surface2->SetBounds(gfx::Size(30, 30)); 9891 render_surface2->SetBounds(gfx::Size(30, 30));
9893 render_surface2->test_properties()->force_render_surface = true; 9892 render_surface2->test_properties()->force_render_surface = true;
9894 test_layer->SetBounds(gfx::Size(30, 30)); 9893 test_layer->SetBounds(gfx::Size(30, 30));
9895 test_layer->SetDrawsContent(true); 9894 test_layer->SetDrawsContent(true);
9896 9895
9897 // We want layer between the two targets to create a clip node and transform 9896 // We want layer between the two targets to create a clip node and effect
9898 // node but it shouldn't create a render surface. 9897 // node but it shouldn't create a render surface.
9899 between_targets->SetMasksToBounds(true); 9898 between_targets->SetMasksToBounds(true);
9900 between_targets->Set3dSortingContextId(2); 9899 between_targets->test_properties()->opacity = 0.5f;
9901 9900
9902 ExecuteCalculateDrawProperties(root); 9901 ExecuteCalculateDrawProperties(root);
9903 9902
9904 TransformTree& tree = 9903 EffectTree& tree = root->layer_tree_impl()->property_trees()->effect_tree;
9905 root->layer_tree_impl()->property_trees()->transform_tree; 9904 EffectNode* node = tree.Node(render_surface1->effect_tree_index());
9906 TransformNode* node = tree.Node(render_surface1->transform_tree_index());
9907 EXPECT_EQ(node->surface_contents_scale, gfx::Vector2dF(2.f, 2.f)); 9905 EXPECT_EQ(node->surface_contents_scale, gfx::Vector2dF(2.f, 2.f));
9908 9906
9909 node = tree.Node(between_targets->transform_tree_index()); 9907 node = tree.Node(between_targets->effect_tree_index());
9910 EXPECT_EQ(node->surface_contents_scale, gfx::Vector2dF(1.f, 1.f)); 9908 EXPECT_EQ(node->surface_contents_scale, gfx::Vector2dF(1.f, 1.f));
9911 9909
9912 node = tree.Node(render_surface2->transform_tree_index()); 9910 node = tree.Node(render_surface2->effect_tree_index());
9913 EXPECT_EQ(node->surface_contents_scale, gfx::Vector2dF(2.f, 2.f)); 9911 EXPECT_EQ(node->surface_contents_scale, gfx::Vector2dF(2.f, 2.f));
9914 9912
9915 EXPECT_EQ(gfx::Rect(15, 15), test_layer->visible_layer_rect()); 9913 EXPECT_EQ(gfx::Rect(15, 15), test_layer->visible_layer_rect());
9916 } 9914 }
9917 9915
9918 TEST_F(LayerTreeHostCommonTest, NoisyTransform) { 9916 TEST_F(LayerTreeHostCommonTest, NoisyTransform) {
9919 LayerImpl* root = root_layer_for_testing(); 9917 LayerImpl* root = root_layer_for_testing();
9920 LayerImpl* render_surface = AddChild<LayerImpl>(root); 9918 LayerImpl* render_surface = AddChild<LayerImpl>(root);
9921 LayerImpl* scroll_child = AddChild<LayerImpl>(render_surface); 9919 LayerImpl* scroll_child = AddChild<LayerImpl>(render_surface);
9922 LayerImpl* scroll_clip = AddChild<LayerImpl>(render_surface); 9920 LayerImpl* scroll_clip = AddChild<LayerImpl>(render_surface);
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
10374 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 10372 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
10375 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 10373 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
10376 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 10374 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
10377 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 10375 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
10378 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 10376 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
10379 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 10377 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
10380 } 10378 }
10381 10379
10382 } // namespace 10380 } // namespace
10383 } // namespace cc 10381 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698