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

Side by Side Diff: cc/test/layer_tree_host_common_test.cc

Issue 1491033002: Create RenderSurface on Effect Tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@alwayspt
Patch Set: fix for crash Created 5 years 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/test/layer_tree_host_common_test.h ('k') | cc/tiles/tile_manager_perftest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/test/layer_tree_host_common_test.h" 5 #include "cc/test/layer_tree_host_common_test.h"
6 6
7 #include "cc/layers/layer.h" 7 #include "cc/layers/layer.h"
8 #include "cc/layers/layer_impl.h" 8 #include "cc/layers/layer_impl.h"
9 #include "cc/test/fake_layer_tree_host.h" 9 #include "cc/test/fake_layer_tree_host.h"
10 #include "cc/trees/draw_property_utils.h" 10 #include "cc/trees/draw_property_utils.h"
11 #include "cc/trees/layer_tree_host_common.h" 11 #include "cc/trees/layer_tree_host_common.h"
12 12
13 namespace cc { 13 namespace cc {
14
15 LayerTreeHostCommonTestBase::LayerTreeHostCommonTestBase( 14 LayerTreeHostCommonTestBase::LayerTreeHostCommonTestBase(
16 const LayerTreeSettings& settings) 15 const LayerTreeSettings& settings)
17 : LayerTestCommon::LayerImplTest(settings), 16 : LayerTestCommon::LayerImplTest(settings),
18 render_surface_layer_list_count_(0) { 17 render_surface_layer_list_count_(0) {
19 } 18 }
20 19
21 LayerTreeHostCommonTestBase::~LayerTreeHostCommonTestBase() { 20 LayerTreeHostCommonTestBase::~LayerTreeHostCommonTestBase() {
22 } 21 }
23 22
24 void LayerTreeHostCommonTestBase::SetLayerPropertiesForTesting( 23 void LayerTreeHostCommonTestBase::SetLayerPropertiesForTesting(
25 Layer* layer, 24 Layer* layer,
26 const gfx::Transform& transform, 25 const gfx::Transform& transform,
27 const gfx::Point3F& transform_origin, 26 const gfx::Point3F& transform_origin,
28 const gfx::PointF& position, 27 const gfx::PointF& position,
29 const gfx::Size& bounds, 28 const gfx::Size& bounds,
30 bool flatten_transform, 29 bool flatten_transform,
31 bool is_3d_sorted) { 30 bool is_3d_sorted) {
32 SetLayerPropertiesForTestingInternal(layer, transform, transform_origin, 31 SetLayerPropertiesForTestingInternal(layer, transform, transform_origin,
33 position, bounds, flatten_transform, 32 position, bounds, flatten_transform,
34 is_3d_sorted); 33 is_3d_sorted);
35 } 34 }
36 35
37 void LayerTreeHostCommonTestBase::SetLayerPropertiesForTesting( 36 void LayerTreeHostCommonTestBase::SetLayerPropertiesForTesting(
38 LayerImpl* layer, 37 LayerImpl* layer,
39 const gfx::Transform& transform, 38 const gfx::Transform& transform,
40 const gfx::Point3F& transform_origin, 39 const gfx::Point3F& transform_origin,
41 const gfx::PointF& position, 40 const gfx::PointF& position,
42 const gfx::Size& bounds, 41 const gfx::Size& bounds,
43 bool flatten_transform, 42 bool flatten_transform,
43 bool is_3d_sorted) {
44 SetLayerPropertiesForTestingInternal(layer, transform, transform_origin,
45 position, bounds, flatten_transform,
46 is_3d_sorted);
47 }
48
49 void LayerTreeHostCommonTestBase::SetLayerPropertiesForTesting(
50 LayerImpl* layer,
51 const gfx::Transform& transform,
52 const gfx::Point3F& transform_origin,
53 const gfx::PointF& position,
54 const gfx::Size& bounds,
55 bool flatten_transform,
44 bool is_3d_sorted, 56 bool is_3d_sorted,
45 bool create_render_surface) { 57 bool create_render_surface) {
46 SetLayerPropertiesForTestingInternal(layer, transform, transform_origin, 58 SetLayerPropertiesForTestingInternal(layer, transform, transform_origin,
47 position, bounds, flatten_transform, 59 position, bounds, flatten_transform,
48 is_3d_sorted); 60 is_3d_sorted);
49 if (create_render_surface) { 61 if (create_render_surface) {
50 layer->SetHasRenderSurface(true); 62 layer->SetForceRenderSurface(true);
51 } 63 }
52 } 64 }
53 65
54 void LayerTreeHostCommonTestBase::ExecuteCalculateDrawProperties( 66 void LayerTreeHostCommonTestBase::ExecuteCalculateDrawProperties(
55 Layer* root_layer, 67 Layer* root_layer,
56 float device_scale_factor, 68 float device_scale_factor,
57 float page_scale_factor, 69 float page_scale_factor,
58 Layer* page_scale_layer, 70 Layer* page_scale_layer,
59 bool can_use_lcd_text, 71 bool can_use_lcd_text,
60 bool layers_always_allowed_lcd_text) { 72 bool layers_always_allowed_lcd_text) {
(...skipping 15 matching lines...) Expand all
76 inputs.page_scale_layer = page_scale_layer; 88 inputs.page_scale_layer = page_scale_layer;
77 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 89 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
78 } 90 }
79 91
80 void LayerTreeHostCommonTestBase:: 92 void LayerTreeHostCommonTestBase::
81 ExecuteCalculateDrawPropertiesWithPropertyTrees(Layer* root_layer) { 93 ExecuteCalculateDrawPropertiesWithPropertyTrees(Layer* root_layer) {
82 DCHECK(root_layer->layer_tree_host()); 94 DCHECK(root_layer->layer_tree_host());
83 LayerTreeHostCommon::PreCalculateMetaInformation(root_layer); 95 LayerTreeHostCommon::PreCalculateMetaInformation(root_layer);
84 96
85 gfx::Transform identity_transform; 97 gfx::Transform identity_transform;
86 bool preserves_2d_axis_alignment = false; 98
87 bool can_render_to_separate_surface = true; 99 bool can_render_to_separate_surface = true;
88 LayerTreeHostCommon::UpdateRenderSurfaces(
89 root_layer, can_render_to_separate_surface, identity_transform,
90 preserves_2d_axis_alignment);
91 100
92 Layer* page_scale_layer = nullptr; 101 Layer* page_scale_layer = nullptr;
93 Layer* inner_viewport_scroll_layer = 102 Layer* inner_viewport_scroll_layer =
94 root_layer->layer_tree_host()->inner_viewport_scroll_layer(); 103 root_layer->layer_tree_host()->inner_viewport_scroll_layer();
95 Layer* outer_viewport_scroll_layer = 104 Layer* outer_viewport_scroll_layer =
96 root_layer->layer_tree_host()->outer_viewport_scroll_layer(); 105 root_layer->layer_tree_host()->outer_viewport_scroll_layer();
97 const Layer* overscroll_elasticity_layer = 106 const Layer* overscroll_elasticity_layer =
98 root_layer->layer_tree_host()->overscroll_elasticity_layer(); 107 root_layer->layer_tree_host()->overscroll_elasticity_layer();
99 gfx::Vector2dF elastic_overscroll = 108 gfx::Vector2dF elastic_overscroll =
100 root_layer->layer_tree_host()->elastic_overscroll(); 109 root_layer->layer_tree_host()->elastic_overscroll();
(...skipping 10 matching lines...) Expand all
111 can_render_to_separate_surface, 120 can_render_to_separate_surface,
112 root_layer->layer_tree_host()->property_trees(), &update_layer_list_); 121 root_layer->layer_tree_host()->property_trees(), &update_layer_list_);
113 } 122 }
114 123
115 void LayerTreeHostCommonTestBase:: 124 void LayerTreeHostCommonTestBase::
116 ExecuteCalculateDrawPropertiesWithPropertyTrees(LayerImpl* root_layer) { 125 ExecuteCalculateDrawPropertiesWithPropertyTrees(LayerImpl* root_layer) {
117 DCHECK(root_layer->layer_tree_impl()); 126 DCHECK(root_layer->layer_tree_impl());
118 LayerTreeHostCommon::PreCalculateMetaInformationForTesting(root_layer); 127 LayerTreeHostCommon::PreCalculateMetaInformationForTesting(root_layer);
119 128
120 gfx::Transform identity_transform; 129 gfx::Transform identity_transform;
130
121 bool can_render_to_separate_surface = true; 131 bool can_render_to_separate_surface = true;
132
122 LayerImpl* page_scale_layer = nullptr; 133 LayerImpl* page_scale_layer = nullptr;
123 LayerImpl* inner_viewport_scroll_layer = 134 LayerImpl* inner_viewport_scroll_layer =
124 root_layer->layer_tree_impl()->InnerViewportScrollLayer(); 135 root_layer->layer_tree_impl()->InnerViewportScrollLayer();
125 LayerImpl* outer_viewport_scroll_layer = 136 LayerImpl* outer_viewport_scroll_layer =
126 root_layer->layer_tree_impl()->OuterViewportScrollLayer(); 137 root_layer->layer_tree_impl()->OuterViewportScrollLayer();
127 LayerImpl* overscroll_elasticity_layer = 138 LayerImpl* overscroll_elasticity_layer =
128 root_layer->layer_tree_impl()->OverscrollElasticityLayer(); 139 root_layer->layer_tree_impl()->OverscrollElasticityLayer();
129 gfx::Vector2dF elastic_overscroll = 140 gfx::Vector2dF elastic_overscroll =
130 root_layer->layer_tree_impl()->elastic_overscroll()->Current( 141 root_layer->layer_tree_impl()->elastic_overscroll()->Current(
131 root_layer->layer_tree_impl()->IsActiveTree()); 142 root_layer->layer_tree_impl()->IsActiveTree());
132 float page_scale_factor = 1.f; 143 float page_scale_factor = 1.f;
133 float device_scale_factor = 1.f; 144 float device_scale_factor = 1.f;
134 gfx::Size device_viewport_size = 145 gfx::Size device_viewport_size =
135 gfx::Size(root_layer->bounds().width() * device_scale_factor, 146 gfx::Size(root_layer->bounds().width() * device_scale_factor,
136 root_layer->bounds().height() * device_scale_factor); 147 root_layer->bounds().height() * device_scale_factor);
137 std::vector<LayerImpl*> update_layer_list; 148 update_layer_list_impl_.reset(new LayerImplList);
138 BuildPropertyTreesAndComputeVisibleRects( 149 BuildPropertyTreesAndComputeVisibleRects(
139 root_layer, page_scale_layer, inner_viewport_scroll_layer, 150 root_layer, page_scale_layer, inner_viewport_scroll_layer,
140 outer_viewport_scroll_layer, overscroll_elasticity_layer, 151 outer_viewport_scroll_layer, overscroll_elasticity_layer,
141 elastic_overscroll, page_scale_factor, device_scale_factor, 152 elastic_overscroll, page_scale_factor, device_scale_factor,
142 gfx::Rect(device_viewport_size), identity_transform, 153 gfx::Rect(device_viewport_size), identity_transform,
143 can_render_to_separate_surface, 154 can_render_to_separate_surface,
144 root_layer->layer_tree_impl()->property_trees(), &update_layer_list); 155 root_layer->layer_tree_impl()->property_trees(),
156 update_layer_list_impl_.get());
145 } 157 }
146 158
147 void LayerTreeHostCommonTestBase::ExecuteCalculateDrawProperties( 159 void LayerTreeHostCommonTestBase::ExecuteCalculateDrawProperties(
148 LayerImpl* root_layer, 160 LayerImpl* root_layer,
149 float device_scale_factor, 161 float device_scale_factor,
150 float page_scale_factor, 162 float page_scale_factor,
151 LayerImpl* page_scale_layer, 163 LayerImpl* page_scale_layer,
152 bool can_use_lcd_text, 164 bool can_use_lcd_text,
153 bool layers_always_allowed_lcd_text) { 165 bool layers_always_allowed_lcd_text) {
154 host_impl()->active_tree()->SetDeviceScaleFactor(device_scale_factor); 166 host_impl()->active_tree()->SetDeviceScaleFactor(device_scale_factor);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 LayerTreeHostCommonTest::LayerTreeHostCommonTest() 226 LayerTreeHostCommonTest::LayerTreeHostCommonTest()
215 : LayerTreeHostCommonTestBase(LayerTreeSettings()) { 227 : LayerTreeHostCommonTestBase(LayerTreeSettings()) {
216 } 228 }
217 229
218 LayerTreeHostCommonTest::LayerTreeHostCommonTest( 230 LayerTreeHostCommonTest::LayerTreeHostCommonTest(
219 const LayerTreeSettings& settings) 231 const LayerTreeSettings& settings)
220 : LayerTreeHostCommonTestBase(settings) { 232 : LayerTreeHostCommonTestBase(settings) {
221 } 233 }
222 234
223 } // namespace cc 235 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_host_common_test.h ('k') | cc/tiles/tile_manager_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698