OLD | NEW |
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_sorter.h" | 5 #include "cc/trees/layer_sorter.h" |
6 | 6 |
7 #include "cc/base/math_util.h" | 7 #include "cc/base/math_util.h" |
8 #include "cc/layers/layer_impl.h" | 8 #include "cc/layers/layer_impl.h" |
9 #include "cc/test/fake_impl_proxy.h" | 9 #include "cc/test/fake_impl_proxy.h" |
10 #include "cc/test/fake_layer_tree_host_impl.h" | 10 #include "cc/test/fake_layer_tree_host_impl.h" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 layer4->SetBounds(gfx::Size(40, 40)); | 241 layer4->SetBounds(gfx::Size(40, 40)); |
242 layer4->SetContentBounds(gfx::Size(40, 40)); | 242 layer4->SetContentBounds(gfx::Size(40, 40)); |
243 layer4->draw_properties().target_space_transform = FrontMatrix; | 243 layer4->draw_properties().target_space_transform = FrontMatrix; |
244 layer4->SetDrawsContent(true); | 244 layer4->SetDrawsContent(true); |
245 | 245 |
246 layer5->SetBounds(gfx::Size(50, 50)); | 246 layer5->SetBounds(gfx::Size(50, 50)); |
247 layer5->SetContentBounds(gfx::Size(50, 50)); | 247 layer5->SetContentBounds(gfx::Size(50, 50)); |
248 layer5->draw_properties().target_space_transform = BehindMatrix; | 248 layer5->draw_properties().target_space_transform = BehindMatrix; |
249 layer5->SetDrawsContent(true); | 249 layer5->SetDrawsContent(true); |
250 | 250 |
251 std::vector<LayerImpl*> layer_list; | 251 LayerImplList layer_list; |
252 layer_list.push_back(layer1.get()); | 252 layer_list.push_back(layer1.get()); |
253 layer_list.push_back(layer2.get()); | 253 layer_list.push_back(layer2.get()); |
254 layer_list.push_back(layer3.get()); | 254 layer_list.push_back(layer3.get()); |
255 layer_list.push_back(layer4.get()); | 255 layer_list.push_back(layer4.get()); |
256 layer_list.push_back(layer5.get()); | 256 layer_list.push_back(layer5.get()); |
257 | 257 |
258 ASSERT_EQ(5u, layer_list.size()); | 258 ASSERT_EQ(5u, layer_list.size()); |
259 EXPECT_EQ(1, layer_list[0]->id()); | 259 EXPECT_EQ(1, layer_list[0]->id()); |
260 EXPECT_EQ(2, layer_list[1]->id()); | 260 EXPECT_EQ(2, layer_list[1]->id()); |
261 EXPECT_EQ(3, layer_list[2]->id()); | 261 EXPECT_EQ(3, layer_list[2]->id()); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 layer1->SetBounds(gfx::Size(10, 10)); | 298 layer1->SetBounds(gfx::Size(10, 10)); |
299 layer1->SetContentBounds(gfx::Size(10, 10)); | 299 layer1->SetContentBounds(gfx::Size(10, 10)); |
300 layer1->draw_properties().target_space_transform = BehindMatrix; | 300 layer1->draw_properties().target_space_transform = BehindMatrix; |
301 layer1->SetDrawsContent(true); | 301 layer1->SetDrawsContent(true); |
302 | 302 |
303 layer2->SetBounds(gfx::Size(10, 10)); | 303 layer2->SetBounds(gfx::Size(10, 10)); |
304 layer2->SetContentBounds(gfx::Size(10, 10)); | 304 layer2->SetContentBounds(gfx::Size(10, 10)); |
305 layer2->draw_properties().target_space_transform = FrontMatrix; | 305 layer2->draw_properties().target_space_transform = FrontMatrix; |
306 layer2->SetDrawsContent(true); | 306 layer2->SetDrawsContent(true); |
307 | 307 |
308 std::vector<LayerImpl*> layer_list; | 308 LayerImplList layer_list; |
309 layer_list.push_back(layer1.get()); | 309 layer_list.push_back(layer1.get()); |
310 layer_list.push_back(layer2.get()); | 310 layer_list.push_back(layer2.get()); |
311 | 311 |
312 ASSERT_EQ(2u, layer_list.size()); | 312 ASSERT_EQ(2u, layer_list.size()); |
313 EXPECT_EQ(1, layer_list[0]->id()); | 313 EXPECT_EQ(1, layer_list[0]->id()); |
314 EXPECT_EQ(2, layer_list[1]->id()); | 314 EXPECT_EQ(2, layer_list[1]->id()); |
315 | 315 |
316 LayerSorter layer_sorter; | 316 LayerSorter layer_sorter; |
317 layer_sorter.Sort(layer_list.begin(), layer_list.end()); | 317 layer_sorter.Sort(layer_list.begin(), layer_list.end()); |
318 | 318 |
319 ASSERT_EQ(2u, layer_list.size()); | 319 ASSERT_EQ(2u, layer_list.size()); |
320 EXPECT_EQ(1, layer_list[0]->id()); | 320 EXPECT_EQ(1, layer_list[0]->id()); |
321 EXPECT_EQ(2, layer_list[1]->id()); | 321 EXPECT_EQ(2, layer_list[1]->id()); |
322 } | 322 } |
323 | 323 |
324 } // namespace | 324 } // namespace |
325 } // namespace cc | 325 } // namespace cc |
326 | 326 |
OLD | NEW |