OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1424 AppendQuadsData data; | 1424 AppendQuadsData data; |
1425 active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, nullptr); | 1425 active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, nullptr); |
1426 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); | 1426 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); |
1427 active_layer_->DidDraw(nullptr); | 1427 active_layer_->DidDraw(nullptr); |
1428 | 1428 |
1429 ASSERT_EQ(1U, render_pass->quad_list.size()); | 1429 ASSERT_EQ(1U, render_pass->quad_list.size()); |
1430 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, | 1430 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, |
1431 render_pass->quad_list.front()->material); | 1431 render_pass->quad_list.front()->material); |
1432 } | 1432 } |
1433 | 1433 |
1434 TEST_F(PictureLayerImplTest, SolidColorLayerImplOnlyDrawsVisibleQuads) { | |
1435 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | |
1436 | |
1437 gfx::Size tile_size(1000, 1000); | |
1438 gfx::Size layer_bounds(1000000, 1000000); | |
1439 gfx::Rect visible_rect(1000, 1000); | |
1440 | |
1441 scoped_refptr<FakePicturePileImpl> pending_pile = | |
1442 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); | |
1443 scoped_refptr<FakePicturePileImpl> active_pile = | |
1444 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); | |
1445 | |
1446 pending_pile->set_is_solid_color(); | |
1447 active_pile->set_is_solid_color(); | |
1448 | |
1449 SetupTrees(pending_pile, active_pile); | |
1450 | |
1451 AppendQuadsData data; | |
1452 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); | |
1453 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); | |
1454 active_layer_->DidDraw(nullptr); | |
1455 | |
1456 for (auto& quad : render_pass->quad_list) { | |
1457 EXPECT_TRUE(visible_rect.Contains(quad.rect)); | |
danakj
2014/10/23 23:38:21
the visible_rect is not used at all except here. h
hendrikw
2014/10/23 23:53:48
My bad, I meant to remove the one below, and keep
| |
1458 } | |
1459 } | |
1460 | |
1434 TEST_F(PictureLayerImplTest, MarkRequiredOffscreenTiles) { | 1461 TEST_F(PictureLayerImplTest, MarkRequiredOffscreenTiles) { |
1435 gfx::Size tile_size(100, 100); | 1462 gfx::Size tile_size(100, 100); |
1436 gfx::Size layer_bounds(200, 200); | 1463 gfx::Size layer_bounds(200, 200); |
1437 | 1464 |
1438 scoped_refptr<FakePicturePileImpl> pending_pile = | 1465 scoped_refptr<FakePicturePileImpl> pending_pile = |
1439 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1466 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
1440 SetupPendingTree(pending_pile); | 1467 SetupPendingTree(pending_pile); |
1441 | 1468 |
1442 gfx::Transform transform; | 1469 gfx::Transform transform; |
1443 gfx::Transform transform_for_tile_priority; | 1470 gfx::Transform transform_for_tile_priority; |
(...skipping 2949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4393 host_impl_.active_tree()->UpdateDrawProperties(); | 4420 host_impl_.active_tree()->UpdateDrawProperties(); |
4394 ASSERT_GT(active_layer_->tilings()->num_tilings(), 0u); | 4421 ASSERT_GT(active_layer_->tilings()->num_tilings(), 0u); |
4395 std::vector<Tile*> tiles = | 4422 std::vector<Tile*> tiles = |
4396 active_layer_->tilings()->tiling_at(0)->AllTilesForTesting(); | 4423 active_layer_->tilings()->tiling_at(0)->AllTilesForTesting(); |
4397 EXPECT_FALSE(tiles.empty()); | 4424 EXPECT_FALSE(tiles.empty()); |
4398 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); | 4425 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); |
4399 } | 4426 } |
4400 | 4427 |
4401 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 4428 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
4402 AppendQuadsData data; | 4429 AppendQuadsData data; |
4430 active_layer_->draw_properties().visible_content_rect = layer_rect; | |
danakj
2014/10/23 23:38:21
why isn't this set by updatedrawproperties?
do yo
| |
4403 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); | 4431 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); |
4404 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); | 4432 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); |
4405 active_layer_->DidDraw(nullptr); | 4433 active_layer_->DidDraw(nullptr); |
4406 | 4434 |
4407 DrawQuad::Material expected = test_for_solid | 4435 DrawQuad::Material expected = test_for_solid |
4408 ? DrawQuad::Material::SOLID_COLOR | 4436 ? DrawQuad::Material::SOLID_COLOR |
4409 : DrawQuad::Material::TILED_CONTENT; | 4437 : DrawQuad::Material::TILED_CONTENT; |
4410 EXPECT_EQ(expected, render_pass->quad_list.front()->material); | 4438 EXPECT_EQ(expected, render_pass->quad_list.front()->material); |
4411 } | 4439 } |
4412 | 4440 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4550 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4578 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
4551 EXPECT_EQ(result.width(), 448); | 4579 EXPECT_EQ(result.width(), 448); |
4552 EXPECT_EQ(result.height(), 448); | 4580 EXPECT_EQ(result.height(), 448); |
4553 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4581 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
4554 EXPECT_EQ(result.width(), 512); | 4582 EXPECT_EQ(result.width(), 512); |
4555 EXPECT_EQ(result.height(), 500 + 2); | 4583 EXPECT_EQ(result.height(), 500 + 2); |
4556 } | 4584 } |
4557 | 4585 |
4558 } // namespace | 4586 } // namespace |
4559 } // namespace cc | 4587 } // namespace cc |
OLD | NEW |