| 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 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1380 gfx::Rect layer_invalidation(150, 200, 30, 180); | 1380 gfx::Rect layer_invalidation(150, 200, 30, 180); |
| 1381 Region invalidation(layer_invalidation); | 1381 Region invalidation(layer_invalidation); |
| 1382 AddDefaultTilingsWithInvalidation(invalidation); | 1382 AddDefaultTilingsWithInvalidation(invalidation); |
| 1383 | 1383 |
| 1384 AppendQuadsData data; | 1384 AppendQuadsData data; |
| 1385 active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, NULL); | 1385 active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, NULL); |
| 1386 active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data); | 1386 active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data); |
| 1387 active_layer_->DidDraw(NULL); | 1387 active_layer_->DidDraw(NULL); |
| 1388 | 1388 |
| 1389 ASSERT_EQ(1U, render_pass->quad_list.size()); | 1389 ASSERT_EQ(1U, render_pass->quad_list.size()); |
| 1390 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, render_pass->quad_list[0]->material); | 1390 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, |
| 1391 render_pass->quad_list.front()->material); |
| 1391 } | 1392 } |
| 1392 | 1393 |
| 1393 TEST_F(PictureLayerImplTest, MarkRequiredNullTiles) { | 1394 TEST_F(PictureLayerImplTest, MarkRequiredNullTiles) { |
| 1394 gfx::Size tile_size(100, 100); | 1395 gfx::Size tile_size(100, 100); |
| 1395 gfx::Size layer_bounds(1000, 1000); | 1396 gfx::Size layer_bounds(1000, 1000); |
| 1396 | 1397 |
| 1397 scoped_refptr<FakePicturePileImpl> pending_pile = | 1398 scoped_refptr<FakePicturePileImpl> pending_pile = |
| 1398 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); | 1399 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); |
| 1399 // Layers with entirely empty piles can't get tilings. | 1400 // Layers with entirely empty piles can't get tilings. |
| 1400 pending_pile->AddRecordingAt(0, 0); | 1401 pending_pile->AddRecordingAt(0, 0); |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1697 MockOcclusionTracker<LayerImpl> occlusion_tracker; | 1698 MockOcclusionTracker<LayerImpl> occlusion_tracker; |
| 1698 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 1699 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
| 1699 AppendQuadsData data; | 1700 AppendQuadsData data; |
| 1700 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL); | 1701 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL); |
| 1701 active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data); | 1702 active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data); |
| 1702 active_layer_->DidDraw(NULL); | 1703 active_layer_->DidDraw(NULL); |
| 1703 | 1704 |
| 1704 // All high res tiles drew, and the one ideal res tile drew. | 1705 // All high res tiles drew, and the one ideal res tile drew. |
| 1705 ASSERT_GT(render_pass->quad_list.size(), 9u); | 1706 ASSERT_GT(render_pass->quad_list.size(), 9u); |
| 1706 EXPECT_EQ(gfx::SizeF(99.f, 99.f), | 1707 EXPECT_EQ(gfx::SizeF(99.f, 99.f), |
| 1707 TileDrawQuad::MaterialCast(render_pass->quad_list[0]) | 1708 TileDrawQuad::MaterialCast(render_pass->quad_list.front()) |
| 1708 ->tex_coord_rect.size()); | 1709 ->tex_coord_rect.size()); |
| 1709 EXPECT_EQ(gfx::SizeF(49.5f, 49.5f), | 1710 EXPECT_EQ(gfx::SizeF(49.5f, 49.5f), |
| 1710 TileDrawQuad::MaterialCast(render_pass->quad_list[1]) | 1711 TileDrawQuad::MaterialCast(render_pass->quad_list.ElementAt(1)) |
| 1711 ->tex_coord_rect.size()); | 1712 ->tex_coord_rect.size()); |
| 1712 | 1713 |
| 1713 // Neither the high res nor the ideal tiles were considered as incomplete. | 1714 // Neither the high res nor the ideal tiles were considered as incomplete. |
| 1714 EXPECT_EQ(0u, data.num_missing_tiles); | 1715 EXPECT_EQ(0u, data.num_missing_tiles); |
| 1715 EXPECT_EQ(0u, data.num_incomplete_tiles); | 1716 EXPECT_EQ(0u, data.num_incomplete_tiles); |
| 1716 } | 1717 } |
| 1717 | 1718 |
| 1718 TEST_F(PictureLayerImplTest, HighResRequiredWhenUnsharedActiveAllReady) { | 1719 TEST_F(PictureLayerImplTest, HighResRequiredWhenUnsharedActiveAllReady) { |
| 1719 gfx::Size layer_bounds(400, 400); | 1720 gfx::Size layer_bounds(400, 400); |
| 1720 gfx::Size tile_size(100, 100); | 1721 gfx::Size tile_size(100, 100); |
| (...skipping 2641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4362 SetupPendingTree(pending_pile2); | 4363 SetupPendingTree(pending_pile2); |
| 4363 ActivateTree(); | 4364 ActivateTree(); |
| 4364 | 4365 |
| 4365 // We've switched to a solid color, so we should end up with no tilings. | 4366 // We've switched to a solid color, so we should end up with no tilings. |
| 4366 ASSERT_TRUE(active_layer_->tilings()); | 4367 ASSERT_TRUE(active_layer_->tilings()); |
| 4367 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); | 4368 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); |
| 4368 } | 4369 } |
| 4369 | 4370 |
| 4370 } // namespace | 4371 } // namespace |
| 4371 } // namespace cc | 4372 } // namespace cc |
| OLD | NEW |