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

Side by Side Diff: cc/layers/layer_iterator_unittest.cc

Issue 1479883002: cc: Fix draw transform computation for non-drawn layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove LayerImpl::draw_transform() 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/layers/layer_iterator.h" 5 #include "cc/layers/layer_iterator.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "cc/layers/layer.h" 9 #include "cc/layers/layer.h"
10 #include "cc/test/fake_layer_tree_host.h" 10 #include "cc/test/fake_layer_tree_host.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 root_layer->AddChild(std::move(first)); 133 root_layer->AddChild(std::move(first));
134 root_layer->AddChild(std::move(second)); 134 root_layer->AddChild(std::move(second));
135 root_layer->AddChild(std::move(third)); 135 root_layer->AddChild(std::move(third));
136 root_layer->AddChild(std::move(fourth)); 136 root_layer->AddChild(std::move(fourth));
137 137
138 root_layer->SetHasRenderSurface(true); 138 root_layer->SetHasRenderSurface(true);
139 host_impl_.active_tree()->SetRootLayer(std::move(root_layer)); 139 host_impl_.active_tree()->SetRootLayer(std::move(root_layer));
140 140
141 LayerImplList render_surface_layer_list; 141 LayerImplList render_surface_layer_list;
142 host_impl_.active_tree()->IncrementRenderSurfaceListIdForTesting();
142 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 143 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
143 root_ptr, root_ptr->bounds(), &render_surface_layer_list); 144 root_ptr, root_ptr->bounds(), &render_surface_layer_list,
145 host_impl_.active_tree()->current_render_surface_list_id());
144 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 146 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
145 147
146 IterateFrontToBack(&render_surface_layer_list); 148 IterateFrontToBack(&render_surface_layer_list);
147 EXPECT_COUNT(root_ptr, 5, -1, 4); 149 EXPECT_COUNT(root_ptr, 5, -1, 4);
148 EXPECT_COUNT(first_ptr, -1, -1, 3); 150 EXPECT_COUNT(first_ptr, -1, -1, 3);
149 EXPECT_COUNT(second_ptr, -1, -1, 2); 151 EXPECT_COUNT(second_ptr, -1, -1, 2);
150 EXPECT_COUNT(third_ptr, -1, -1, 1); 152 EXPECT_COUNT(third_ptr, -1, -1, 1);
151 EXPECT_COUNT(fourth_ptr, -1, -1, 0); 153 EXPECT_COUNT(fourth_ptr, -1, -1, 0);
152 } 154 }
153 155
(...skipping 24 matching lines...) Expand all
178 root2->AddChild(std::move(root22)); 180 root2->AddChild(std::move(root22));
179 root2->AddChild(std::move(root23)); 181 root2->AddChild(std::move(root23));
180 root_layer->AddChild(std::move(root1)); 182 root_layer->AddChild(std::move(root1));
181 root_layer->AddChild(std::move(root2)); 183 root_layer->AddChild(std::move(root2));
182 root_layer->AddChild(std::move(root3)); 184 root_layer->AddChild(std::move(root3));
183 185
184 root_layer->SetHasRenderSurface(true); 186 root_layer->SetHasRenderSurface(true);
185 host_impl_.active_tree()->SetRootLayer(std::move(root_layer)); 187 host_impl_.active_tree()->SetRootLayer(std::move(root_layer));
186 188
187 LayerImplList render_surface_layer_list; 189 LayerImplList render_surface_layer_list;
190 host_impl_.active_tree()->IncrementRenderSurfaceListIdForTesting();
188 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 191 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
189 root_ptr, root_ptr->bounds(), &render_surface_layer_list); 192 root_ptr, root_ptr->bounds(), &render_surface_layer_list,
193 host_impl_.active_tree()->current_render_surface_list_id());
190 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 194 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
191 195
192 IterateFrontToBack(&render_surface_layer_list); 196 IterateFrontToBack(&render_surface_layer_list);
193 EXPECT_COUNT(root_ptr, 9, -1, 8); 197 EXPECT_COUNT(root_ptr, 9, -1, 8);
194 EXPECT_COUNT(root1_ptr, -1, -1, 7); 198 EXPECT_COUNT(root1_ptr, -1, -1, 7);
195 EXPECT_COUNT(root2_ptr, -1, -1, 6); 199 EXPECT_COUNT(root2_ptr, -1, -1, 6);
196 EXPECT_COUNT(root21_ptr, -1, -1, 5); 200 EXPECT_COUNT(root21_ptr, -1, -1, 5);
197 EXPECT_COUNT(root22_ptr, -1, -1, 4); 201 EXPECT_COUNT(root22_ptr, -1, -1, 4);
198 EXPECT_COUNT(root221_ptr, -1, -1, 3); 202 EXPECT_COUNT(root221_ptr, -1, -1, 3);
199 EXPECT_COUNT(root23_ptr, -1, -1, 2); 203 EXPECT_COUNT(root23_ptr, -1, -1, 2);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 root2->AddChild(std::move(root22)); 236 root2->AddChild(std::move(root22));
233 root2->AddChild(std::move(root23)); 237 root2->AddChild(std::move(root23));
234 root_layer->AddChild(std::move(root1)); 238 root_layer->AddChild(std::move(root1));
235 root_layer->AddChild(std::move(root2)); 239 root_layer->AddChild(std::move(root2));
236 root_layer->AddChild(std::move(root3)); 240 root_layer->AddChild(std::move(root3));
237 241
238 root_layer->SetHasRenderSurface(true); 242 root_layer->SetHasRenderSurface(true);
239 host_impl_.active_tree()->SetRootLayer(std::move(root_layer)); 243 host_impl_.active_tree()->SetRootLayer(std::move(root_layer));
240 244
241 LayerImplList render_surface_layer_list; 245 LayerImplList render_surface_layer_list;
246 host_impl_.active_tree()->IncrementRenderSurfaceListIdForTesting();
242 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 247 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
243 root_ptr, root_ptr->bounds(), &render_surface_layer_list); 248 root_ptr, root_ptr->bounds(), &render_surface_layer_list,
249 host_impl_.active_tree()->current_render_surface_list_id());
244 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 250 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
245 251
246 IterateFrontToBack(&render_surface_layer_list); 252 IterateFrontToBack(&render_surface_layer_list);
247 EXPECT_COUNT(root_ptr, 14, -1, 13); 253 EXPECT_COUNT(root_ptr, 14, -1, 13);
248 EXPECT_COUNT(root1_ptr, -1, -1, 12); 254 EXPECT_COUNT(root1_ptr, -1, -1, 12);
249 EXPECT_COUNT(root2_ptr, 10, 11, -1); 255 EXPECT_COUNT(root2_ptr, 10, 11, -1);
250 EXPECT_COUNT(root21_ptr, -1, -1, 9); 256 EXPECT_COUNT(root21_ptr, -1, -1, 9);
251 EXPECT_COUNT(root22_ptr, 7, 8, 6); 257 EXPECT_COUNT(root22_ptr, 7, 8, 6);
252 EXPECT_COUNT(root221_ptr, -1, -1, 5); 258 EXPECT_COUNT(root221_ptr, -1, -1, 5);
253 EXPECT_COUNT(root23_ptr, 3, 4, 2); 259 EXPECT_COUNT(root23_ptr, 3, 4, 2);
254 EXPECT_COUNT(root231_ptr, -1, -1, 1); 260 EXPECT_COUNT(root231_ptr, -1, -1, 1);
255 EXPECT_COUNT(root3_ptr, -1, -1, 0); 261 EXPECT_COUNT(root3_ptr, -1, -1, 0);
256 } 262 }
257 263
258 } // namespace 264 } // namespace
259 } // namespace cc 265 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698