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 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 gfx::Rect layer_invalidation(150, 200, 30, 180); | 1321 gfx::Rect layer_invalidation(150, 200, 30, 180); |
1322 Region invalidation(layer_invalidation); | 1322 Region invalidation(layer_invalidation); |
1323 AddDefaultTilingsWithInvalidation(invalidation); | 1323 AddDefaultTilingsWithInvalidation(invalidation); |
1324 | 1324 |
1325 AppendQuadsData data; | 1325 AppendQuadsData data; |
1326 active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, NULL); | 1326 active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, NULL); |
1327 active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data); | 1327 active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data); |
1328 active_layer_->DidDraw(NULL); | 1328 active_layer_->DidDraw(NULL); |
1329 | 1329 |
1330 ASSERT_EQ(1U, render_pass->quad_list.size()); | 1330 ASSERT_EQ(1U, render_pass->quad_list.size()); |
1331 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, render_pass->quad_list[0]->material); | 1331 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, |
| 1332 render_pass->quad_list.front()->material); |
1332 } | 1333 } |
1333 | 1334 |
1334 TEST_F(PictureLayerImplTest, MarkRequiredNullTiles) { | 1335 TEST_F(PictureLayerImplTest, MarkRequiredNullTiles) { |
1335 gfx::Size tile_size(100, 100); | 1336 gfx::Size tile_size(100, 100); |
1336 gfx::Size layer_bounds(1000, 1000); | 1337 gfx::Size layer_bounds(1000, 1000); |
1337 | 1338 |
1338 scoped_refptr<FakePicturePileImpl> pending_pile = | 1339 scoped_refptr<FakePicturePileImpl> pending_pile = |
1339 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); | 1340 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); |
1340 // Layers with entirely empty piles can't get tilings. | 1341 // Layers with entirely empty piles can't get tilings. |
1341 pending_pile->AddRecordingAt(0, 0); | 1342 pending_pile->AddRecordingAt(0, 0); |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1638 MockOcclusionTracker<LayerImpl> occlusion_tracker; | 1639 MockOcclusionTracker<LayerImpl> occlusion_tracker; |
1639 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 1640 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
1640 AppendQuadsData data; | 1641 AppendQuadsData data; |
1641 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL); | 1642 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL); |
1642 active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data); | 1643 active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data); |
1643 active_layer_->DidDraw(NULL); | 1644 active_layer_->DidDraw(NULL); |
1644 | 1645 |
1645 // All high res tiles drew, and the one ideal res tile drew. | 1646 // All high res tiles drew, and the one ideal res tile drew. |
1646 ASSERT_GT(render_pass->quad_list.size(), 9u); | 1647 ASSERT_GT(render_pass->quad_list.size(), 9u); |
1647 EXPECT_EQ(gfx::SizeF(99.f, 99.f), | 1648 EXPECT_EQ(gfx::SizeF(99.f, 99.f), |
1648 TileDrawQuad::MaterialCast(render_pass->quad_list[0]) | 1649 TileDrawQuad::MaterialCast(render_pass->quad_list.front()) |
1649 ->tex_coord_rect.size()); | 1650 ->tex_coord_rect.size()); |
| 1651 QuadList::Iterator quad_iter = render_pass->quad_list.begin(); |
| 1652 ++quad_iter; |
1650 EXPECT_EQ(gfx::SizeF(49.5f, 49.5f), | 1653 EXPECT_EQ(gfx::SizeF(49.5f, 49.5f), |
1651 TileDrawQuad::MaterialCast(render_pass->quad_list[1]) | 1654 TileDrawQuad::MaterialCast(&*quad_iter)->tex_coord_rect.size()); |
1652 ->tex_coord_rect.size()); | |
1653 | 1655 |
1654 // Neither the high res nor the ideal tiles were considered as incomplete. | 1656 // Neither the high res nor the ideal tiles were considered as incomplete. |
1655 EXPECT_EQ(0u, data.num_missing_tiles); | 1657 EXPECT_EQ(0u, data.num_missing_tiles); |
1656 EXPECT_EQ(0u, data.num_incomplete_tiles); | 1658 EXPECT_EQ(0u, data.num_incomplete_tiles); |
1657 } | 1659 } |
1658 | 1660 |
1659 TEST_F(PictureLayerImplTest, HighResRequiredWhenUnsharedActiveAllReady) { | 1661 TEST_F(PictureLayerImplTest, HighResRequiredWhenUnsharedActiveAllReady) { |
1660 gfx::Size layer_bounds(400, 400); | 1662 gfx::Size layer_bounds(400, 400); |
1661 gfx::Size tile_size(100, 100); | 1663 gfx::Size tile_size(100, 100); |
1662 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); | 1664 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); |
(...skipping 2458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4121 ActivateTree(); | 4123 ActivateTree(); |
4122 EXPECT_TRUE(active_layer_->GetRecycledTwinLayer()); | 4124 EXPECT_TRUE(active_layer_->GetRecycledTwinLayer()); |
4123 EXPECT_EQ(old_pending_layer_, active_layer_->GetRecycledTwinLayer()); | 4125 EXPECT_EQ(old_pending_layer_, active_layer_->GetRecycledTwinLayer()); |
4124 | 4126 |
4125 host_impl_.ResetRecycleTreeForTesting(); | 4127 host_impl_.ResetRecycleTreeForTesting(); |
4126 EXPECT_FALSE(active_layer_->GetRecycledTwinLayer()); | 4128 EXPECT_FALSE(active_layer_->GetRecycledTwinLayer()); |
4127 } | 4129 } |
4128 | 4130 |
4129 } // namespace | 4131 } // namespace |
4130 } // namespace cc | 4132 } // namespace cc |
OLD | NEW |