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

Side by Side Diff: cc/trees/layer_tree_host_impl_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_unittest.cc ('k') | cc/trees/layer_tree_host_in_process.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_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 10084 matching lines...) Expand 10 before | Expand all | Expand 10 after
10095 test_layer->SetBounds(layer_size); 10095 test_layer->SetBounds(layer_size);
10096 gfx::Transform perspective_transform; 10096 gfx::Transform perspective_transform;
10097 perspective_transform.ApplyPerspectiveDepth(2); 10097 perspective_transform.ApplyPerspectiveDepth(2);
10098 test_layer->test_properties()->transform = perspective_transform; 10098 test_layer->test_properties()->transform = perspective_transform;
10099 host_impl_->active_tree()->BuildPropertyTreesForTesting(); 10099 host_impl_->active_tree()->BuildPropertyTreesForTesting();
10100 10100
10101 bool update_lcd_text = false; 10101 bool update_lcd_text = false;
10102 10102
10103 host_impl_->SetViewportSize(gfx::Size(50, 50)); 10103 host_impl_->SetViewportSize(gfx::Size(50, 50));
10104 host_impl_->active_tree()->UpdateDrawProperties(update_lcd_text); 10104 host_impl_->active_tree()->UpdateDrawProperties(update_lcd_text);
10105 TransformNode* node = 10105 EffectNode* node =
10106 host_impl_->active_tree()->property_trees()->transform_tree.Node( 10106 host_impl_->active_tree()->property_trees()->effect_tree.Node(
10107 test_layer->transform_tree_index()); 10107 test_layer->effect_tree_index());
10108 EXPECT_EQ(node->surface_contents_scale, gfx::Vector2dF(1.f, 1.f)); 10108 EXPECT_EQ(node->surface_contents_scale, gfx::Vector2dF(1.f, 1.f));
10109 10109
10110 gfx::Transform external_transform; 10110 gfx::Transform external_transform;
10111 external_transform.Translate(10, 10); 10111 external_transform.Translate(10, 10);
10112 external_transform.Scale(2, 2); 10112 external_transform.Scale(2, 2);
10113 gfx::Rect external_viewport; 10113 gfx::Rect external_viewport;
10114 bool resourceless_software_draw = false; 10114 bool resourceless_software_draw = false;
10115 host_impl_->SetExternalTilePriorityConstraints(external_viewport, 10115 host_impl_->SetExternalTilePriorityConstraints(external_viewport,
10116 external_transform); 10116 external_transform);
10117 10117
10118 // Transform node's sublayer scale should include the device transform scale. 10118 // Transform node's sublayer scale should include the device transform scale.
10119 host_impl_->OnDraw(external_transform, external_viewport, 10119 host_impl_->OnDraw(external_transform, external_viewport,
10120 resourceless_software_draw); 10120 resourceless_software_draw);
10121 node = host_impl_->active_tree()->property_trees()->transform_tree.Node( 10121 node = host_impl_->active_tree()->property_trees()->effect_tree.Node(
10122 test_layer->transform_tree_index()); 10122 test_layer->effect_tree_index());
10123 EXPECT_EQ(node->surface_contents_scale, gfx::Vector2dF(2.f, 2.f)); 10123 EXPECT_EQ(node->surface_contents_scale, gfx::Vector2dF(2.f, 2.f));
10124 10124
10125 // Clear the external transform. 10125 // Clear the external transform.
10126 external_transform = gfx::Transform(); 10126 external_transform = gfx::Transform();
10127 host_impl_->SetExternalTilePriorityConstraints(external_viewport, 10127 host_impl_->SetExternalTilePriorityConstraints(external_viewport,
10128 external_transform); 10128 external_transform);
10129 10129
10130 host_impl_->OnDraw(external_transform, external_viewport, 10130 host_impl_->OnDraw(external_transform, external_viewport,
10131 resourceless_software_draw); 10131 resourceless_software_draw);
10132 node = host_impl_->active_tree()->property_trees()->transform_tree.Node( 10132 node = host_impl_->active_tree()->property_trees()->effect_tree.Node(
10133 test_layer->transform_tree_index()); 10133 test_layer->effect_tree_index());
10134 EXPECT_EQ(node->surface_contents_scale, gfx::Vector2dF(1.f, 1.f)); 10134 EXPECT_EQ(node->surface_contents_scale, gfx::Vector2dF(1.f, 1.f));
10135 } 10135 }
10136 10136
10137 TEST_F(LayerTreeHostImplTest, ScrollAnimated) { 10137 TEST_F(LayerTreeHostImplTest, ScrollAnimated) {
10138 const gfx::Size content_size(1000, 1000); 10138 const gfx::Size content_size(1000, 1000);
10139 const gfx::Size viewport_size(50, 100); 10139 const gfx::Size viewport_size(50, 100);
10140 CreateBasicVirtualViewportLayers(viewport_size, content_size); 10140 CreateBasicVirtualViewportLayers(viewport_size, content_size);
10141 10141
10142 DrawFrame(); 10142 DrawFrame();
10143 10143
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after
11356 LayerImpl::Create(host_impl_->active_tree(), 100)); 11356 LayerImpl::Create(host_impl_->active_tree(), 100));
11357 11357
11358 LayerImpl* in_subtree_of_page_scale_layer = 11358 LayerImpl* in_subtree_of_page_scale_layer =
11359 host_impl_->active_tree()->LayerById(100); 11359 host_impl_->active_tree()->LayerById(100);
11360 in_subtree_of_page_scale_layer->test_properties()->force_render_surface = 11360 in_subtree_of_page_scale_layer->test_properties()->force_render_surface =
11361 true; 11361 true;
11362 host_impl_->active_tree()->BuildPropertyTreesForTesting(); 11362 host_impl_->active_tree()->BuildPropertyTreesForTesting();
11363 11363
11364 DrawFrame(); 11364 DrawFrame();
11365 11365
11366 TransformNode* node = 11366 EffectNode* node =
11367 host_impl_->active_tree()->property_trees()->transform_tree.Node( 11367 host_impl_->active_tree()->property_trees()->effect_tree.Node(
11368 in_subtree_of_page_scale_layer->transform_tree_index()); 11368 in_subtree_of_page_scale_layer->effect_tree_index());
11369 EXPECT_EQ(node->surface_contents_scale, gfx::Vector2dF(1.f, 1.f)); 11369 EXPECT_EQ(node->surface_contents_scale, gfx::Vector2dF(1.f, 1.f));
11370 11370
11371 host_impl_->active_tree()->SetPageScaleOnActiveTree(2.f); 11371 host_impl_->active_tree()->SetPageScaleOnActiveTree(2.f);
11372 11372
11373 DrawFrame(); 11373 DrawFrame();
11374 11374
11375 in_subtree_of_page_scale_layer = host_impl_->active_tree()->LayerById(100); 11375 in_subtree_of_page_scale_layer = host_impl_->active_tree()->LayerById(100);
11376 node = host_impl_->active_tree()->property_trees()->transform_tree.Node( 11376 node = host_impl_->active_tree()->property_trees()->effect_tree.Node(
11377 in_subtree_of_page_scale_layer->transform_tree_index()); 11377 in_subtree_of_page_scale_layer->effect_tree_index());
11378 EXPECT_EQ(node->surface_contents_scale, gfx::Vector2dF(2.f, 2.f)); 11378 EXPECT_EQ(node->surface_contents_scale, gfx::Vector2dF(2.f, 2.f));
11379 } 11379 }
11380 11380
11381 TEST_F(LayerTreeHostImplTest, JitterTest) { 11381 TEST_F(LayerTreeHostImplTest, JitterTest) {
11382 host_impl_->SetViewportSize(gfx::Size(100, 100)); 11382 host_impl_->SetViewportSize(gfx::Size(100, 100));
11383 11383
11384 host_impl_->CreatePendingTree(); 11384 host_impl_->CreatePendingTree();
11385 CreateScrollAndContentsLayers(host_impl_->pending_tree(), 11385 CreateScrollAndContentsLayers(host_impl_->pending_tree(),
11386 gfx::Size(100, 100)); 11386 gfx::Size(100, 100));
11387 host_impl_->pending_tree()->BuildPropertyTreesForTesting(); 11387 host_impl_->pending_tree()->BuildPropertyTreesForTesting();
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
11596 EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_over_scrollbar()); 11596 EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_over_scrollbar());
11597 host_impl_->MouseMoveAt(gfx::Point(10, 150)); 11597 host_impl_->MouseMoveAt(gfx::Point(10, 150));
11598 EXPECT_TRUE(scrollbar_1_animation_controller->mouse_is_near_scrollbar()); 11598 EXPECT_TRUE(scrollbar_1_animation_controller->mouse_is_near_scrollbar());
11599 EXPECT_TRUE(scrollbar_1_animation_controller->mouse_is_over_scrollbar()); 11599 EXPECT_TRUE(scrollbar_1_animation_controller->mouse_is_over_scrollbar());
11600 EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_near_scrollbar()); 11600 EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_near_scrollbar());
11601 EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_over_scrollbar()); 11601 EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_over_scrollbar());
11602 } 11602 }
11603 11603
11604 } // namespace 11604 } // namespace
11605 } // namespace cc 11605 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_common_unittest.cc ('k') | cc/trees/layer_tree_host_in_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698