| 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 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1370 high_res_tiling = pending_layer_->tilings()->tiling_at(0); | 1370 high_res_tiling = pending_layer_->tilings()->tiling_at(0); |
| 1371 EXPECT_LT(1u, high_res_tiling->AllTilesForTesting().size()); | 1371 EXPECT_LT(1u, high_res_tiling->AllTilesForTesting().size()); |
| 1372 | 1372 |
| 1373 // Verify the tiles are not larger than the context's max texture size. | 1373 // Verify the tiles are not larger than the context's max texture size. |
| 1374 Tile* tile = pending_layer_->tilings()->tiling_at(0)->AllTilesForTesting()[0]; | 1374 Tile* tile = pending_layer_->tilings()->tiling_at(0)->AllTilesForTesting()[0]; |
| 1375 EXPECT_GE(140, tile->content_rect().width()); | 1375 EXPECT_GE(140, tile->content_rect().width()); |
| 1376 EXPECT_GE(140, tile->content_rect().height()); | 1376 EXPECT_GE(140, tile->content_rect().height()); |
| 1377 } | 1377 } |
| 1378 | 1378 |
| 1379 TEST_F(PictureLayerImplTest, DisallowTileDrawQuads) { | 1379 TEST_F(PictureLayerImplTest, DisallowTileDrawQuads) { |
| 1380 MockOcclusionTracker<LayerImpl> occlusion_tracker; | |
| 1381 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 1380 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
| 1382 | 1381 |
| 1383 gfx::Size tile_size(400, 400); | 1382 gfx::Size tile_size(400, 400); |
| 1384 gfx::Size layer_bounds(1300, 1900); | 1383 gfx::Size layer_bounds(1300, 1900); |
| 1385 | 1384 |
| 1386 scoped_refptr<FakePicturePileImpl> pending_pile = | 1385 scoped_refptr<FakePicturePileImpl> pending_pile = |
| 1387 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1386 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 1388 scoped_refptr<FakePicturePileImpl> active_pile = | 1387 scoped_refptr<FakePicturePileImpl> active_pile = |
| 1389 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1388 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 1390 | 1389 |
| 1391 SetupTrees(pending_pile, active_pile); | 1390 SetupTrees(pending_pile, active_pile); |
| 1392 | 1391 |
| 1393 active_layer_->draw_properties().visible_content_rect = | 1392 active_layer_->draw_properties().visible_content_rect = |
| 1394 gfx::Rect(layer_bounds); | 1393 gfx::Rect(layer_bounds); |
| 1395 | 1394 |
| 1396 gfx::Rect layer_invalidation(150, 200, 30, 180); | 1395 gfx::Rect layer_invalidation(150, 200, 30, 180); |
| 1397 Region invalidation(layer_invalidation); | 1396 Region invalidation(layer_invalidation); |
| 1398 AddDefaultTilingsWithInvalidation(invalidation); | 1397 AddDefaultTilingsWithInvalidation(invalidation); |
| 1399 | 1398 |
| 1400 AppendQuadsData data; | 1399 AppendQuadsData data; |
| 1401 active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, NULL); | 1400 active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, NULL); |
| 1402 active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data); | 1401 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); |
| 1403 active_layer_->DidDraw(NULL); | 1402 active_layer_->DidDraw(NULL); |
| 1404 | 1403 |
| 1405 ASSERT_EQ(1U, render_pass->quad_list.size()); | 1404 ASSERT_EQ(1U, render_pass->quad_list.size()); |
| 1406 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, | 1405 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, |
| 1407 render_pass->quad_list.front()->material); | 1406 render_pass->quad_list.front()->material); |
| 1408 } | 1407 } |
| 1409 | 1408 |
| 1410 TEST_F(PictureLayerImplTest, MarkRequiredNullTiles) { | 1409 TEST_F(PictureLayerImplTest, MarkRequiredNullTiles) { |
| 1411 gfx::Size tile_size(100, 100); | 1410 gfx::Size tile_size(100, 100); |
| 1412 gfx::Size layer_bounds(1000, 1000); | 1411 gfx::Size layer_bounds(1000, 1000); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1573 } | 1572 } |
| 1574 | 1573 |
| 1575 EXPECT_GT(num_inside, 0); | 1574 EXPECT_GT(num_inside, 0); |
| 1576 EXPECT_GT(num_outside, 0); | 1575 EXPECT_GT(num_outside, 0); |
| 1577 | 1576 |
| 1578 // Activate and draw active layer. | 1577 // Activate and draw active layer. |
| 1579 host_impl_.ActivateSyncTree(); | 1578 host_impl_.ActivateSyncTree(); |
| 1580 host_impl_.active_tree()->UpdateDrawProperties(); | 1579 host_impl_.active_tree()->UpdateDrawProperties(); |
| 1581 active_layer_->draw_properties().visible_content_rect = visible_content_rect; | 1580 active_layer_->draw_properties().visible_content_rect = visible_content_rect; |
| 1582 | 1581 |
| 1583 MockOcclusionTracker<LayerImpl> occlusion_tracker; | |
| 1584 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 1582 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
| 1585 AppendQuadsData data; | 1583 AppendQuadsData data; |
| 1586 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL); | 1584 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL); |
| 1587 active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data); | 1585 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); |
| 1588 active_layer_->DidDraw(NULL); | 1586 active_layer_->DidDraw(NULL); |
| 1589 | 1587 |
| 1590 // All tiles in activation rect is ready to draw. | 1588 // All tiles in activation rect is ready to draw. |
| 1591 EXPECT_EQ(0u, data.num_missing_tiles); | 1589 EXPECT_EQ(0u, data.num_missing_tiles); |
| 1592 EXPECT_EQ(0u, data.num_incomplete_tiles); | 1590 EXPECT_EQ(0u, data.num_incomplete_tiles); |
| 1593 } | 1591 } |
| 1594 | 1592 |
| 1595 TEST_F(PictureLayerImplTest, HighResTileIsComplete) { | 1593 TEST_F(PictureLayerImplTest, HighResTileIsComplete) { |
| 1596 base::TimeTicks time_ticks; | 1594 base::TimeTicks time_ticks; |
| 1597 time_ticks += base::TimeDelta::FromMilliseconds(1); | 1595 time_ticks += base::TimeDelta::FromMilliseconds(1); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1608 SetupPendingTree(pending_pile); | 1606 SetupPendingTree(pending_pile); |
| 1609 ActivateTree(); | 1607 ActivateTree(); |
| 1610 | 1608 |
| 1611 // All high res tiles have resources. | 1609 // All high res tiles have resources. |
| 1612 active_layer_->set_fixed_tile_size(tile_size); | 1610 active_layer_->set_fixed_tile_size(tile_size); |
| 1613 host_impl_.active_tree()->UpdateDrawProperties(); | 1611 host_impl_.active_tree()->UpdateDrawProperties(); |
| 1614 std::vector<Tile*> tiles = | 1612 std::vector<Tile*> tiles = |
| 1615 active_layer_->tilings()->tiling_at(0)->AllTilesForTesting(); | 1613 active_layer_->tilings()->tiling_at(0)->AllTilesForTesting(); |
| 1616 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); | 1614 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); |
| 1617 | 1615 |
| 1618 MockOcclusionTracker<LayerImpl> occlusion_tracker; | |
| 1619 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 1616 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
| 1620 AppendQuadsData data; | 1617 AppendQuadsData data; |
| 1621 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL); | 1618 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL); |
| 1622 active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data); | 1619 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); |
| 1623 active_layer_->DidDraw(NULL); | 1620 active_layer_->DidDraw(NULL); |
| 1624 | 1621 |
| 1625 // All high res tiles drew, nothing was incomplete. | 1622 // All high res tiles drew, nothing was incomplete. |
| 1626 EXPECT_EQ(9u, render_pass->quad_list.size()); | 1623 EXPECT_EQ(9u, render_pass->quad_list.size()); |
| 1627 EXPECT_EQ(0u, data.num_missing_tiles); | 1624 EXPECT_EQ(0u, data.num_missing_tiles); |
| 1628 EXPECT_EQ(0u, data.num_incomplete_tiles); | 1625 EXPECT_EQ(0u, data.num_incomplete_tiles); |
| 1629 } | 1626 } |
| 1630 | 1627 |
| 1631 TEST_F(PictureLayerImplTest, LowResTileIsIncomplete) { | 1628 TEST_F(PictureLayerImplTest, LowResTileIsIncomplete) { |
| 1632 base::TimeTicks time_ticks; | 1629 base::TimeTicks time_ticks; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1650 std::vector<Tile*> high_tiles = | 1647 std::vector<Tile*> high_tiles = |
| 1651 active_layer_->tilings()->tiling_at(0)->AllTilesForTesting(); | 1648 active_layer_->tilings()->tiling_at(0)->AllTilesForTesting(); |
| 1652 high_tiles.erase(high_tiles.begin()); | 1649 high_tiles.erase(high_tiles.begin()); |
| 1653 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(high_tiles); | 1650 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(high_tiles); |
| 1654 | 1651 |
| 1655 // All low res tiles have resources. | 1652 // All low res tiles have resources. |
| 1656 std::vector<Tile*> low_tiles = | 1653 std::vector<Tile*> low_tiles = |
| 1657 active_layer_->tilings()->tiling_at(1)->AllTilesForTesting(); | 1654 active_layer_->tilings()->tiling_at(1)->AllTilesForTesting(); |
| 1658 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(low_tiles); | 1655 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(low_tiles); |
| 1659 | 1656 |
| 1660 MockOcclusionTracker<LayerImpl> occlusion_tracker; | |
| 1661 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 1657 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
| 1662 AppendQuadsData data; | 1658 AppendQuadsData data; |
| 1663 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL); | 1659 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL); |
| 1664 active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data); | 1660 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); |
| 1665 active_layer_->DidDraw(NULL); | 1661 active_layer_->DidDraw(NULL); |
| 1666 | 1662 |
| 1667 // The missing high res tile was replaced by a low res tile. | 1663 // The missing high res tile was replaced by a low res tile. |
| 1668 EXPECT_EQ(9u, render_pass->quad_list.size()); | 1664 EXPECT_EQ(9u, render_pass->quad_list.size()); |
| 1669 EXPECT_EQ(0u, data.num_missing_tiles); | 1665 EXPECT_EQ(0u, data.num_missing_tiles); |
| 1670 EXPECT_EQ(1u, data.num_incomplete_tiles); | 1666 EXPECT_EQ(1u, data.num_incomplete_tiles); |
| 1671 } | 1667 } |
| 1672 | 1668 |
| 1673 TEST_F(PictureLayerImplTest, | 1669 TEST_F(PictureLayerImplTest, |
| 1674 HighResAndIdealResTileIsCompleteWhenRasterScaleIsNotIdeal) { | 1670 HighResAndIdealResTileIsCompleteWhenRasterScaleIsNotIdeal) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1712 | 1708 |
| 1713 // Both tilings still exist. | 1709 // Both tilings still exist. |
| 1714 EXPECT_EQ(2.f, active_layer_->tilings()->tiling_at(0)->contents_scale()); | 1710 EXPECT_EQ(2.f, active_layer_->tilings()->tiling_at(0)->contents_scale()); |
| 1715 EXPECT_EQ(1.f, active_layer_->tilings()->tiling_at(1)->contents_scale()); | 1711 EXPECT_EQ(1.f, active_layer_->tilings()->tiling_at(1)->contents_scale()); |
| 1716 | 1712 |
| 1717 // All high res tiles have resources. | 1713 // All high res tiles have resources. |
| 1718 std::vector<Tile*> high_tiles = | 1714 std::vector<Tile*> high_tiles = |
| 1719 active_layer_->HighResTiling()->AllTilesForTesting(); | 1715 active_layer_->HighResTiling()->AllTilesForTesting(); |
| 1720 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(high_tiles); | 1716 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(high_tiles); |
| 1721 | 1717 |
| 1722 MockOcclusionTracker<LayerImpl> occlusion_tracker; | |
| 1723 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 1718 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
| 1724 AppendQuadsData data; | 1719 AppendQuadsData data; |
| 1725 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL); | 1720 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL); |
| 1726 active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data); | 1721 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); |
| 1727 active_layer_->DidDraw(NULL); | 1722 active_layer_->DidDraw(NULL); |
| 1728 | 1723 |
| 1729 // All high res tiles drew, and the one ideal res tile drew. | 1724 // All high res tiles drew, and the one ideal res tile drew. |
| 1730 ASSERT_GT(render_pass->quad_list.size(), 9u); | 1725 ASSERT_GT(render_pass->quad_list.size(), 9u); |
| 1731 EXPECT_EQ(gfx::SizeF(99.f, 99.f), | 1726 EXPECT_EQ(gfx::SizeF(99.f, 99.f), |
| 1732 TileDrawQuad::MaterialCast(render_pass->quad_list.front()) | 1727 TileDrawQuad::MaterialCast(render_pass->quad_list.front()) |
| 1733 ->tex_coord_rect.size()); | 1728 ->tex_coord_rect.size()); |
| 1734 EXPECT_EQ(gfx::SizeF(49.5f, 49.5f), | 1729 EXPECT_EQ(gfx::SizeF(49.5f, 49.5f), |
| 1735 TileDrawQuad::MaterialCast(render_pass->quad_list.ElementAt(1)) | 1730 TileDrawQuad::MaterialCast(render_pass->quad_list.ElementAt(1)) |
| 1736 ->tex_coord_rect.size()); | 1731 ->tex_coord_rect.size()); |
| (...skipping 1724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3461 SetupDrawPropertiesAndUpdateTiles(pending_layer_, | 3456 SetupDrawPropertiesAndUpdateTiles(pending_layer_, |
| 3462 1.3f, // ideal contents scale | 3457 1.3f, // ideal contents scale |
| 3463 2.7f, // device scale | 3458 2.7f, // device scale |
| 3464 3.2f, // page scale | 3459 3.2f, // page scale |
| 3465 1.f, // maximum animation scale | 3460 1.f, // maximum animation scale |
| 3466 false); | 3461 false); |
| 3467 EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings()); | 3462 EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings()); |
| 3468 } | 3463 } |
| 3469 | 3464 |
| 3470 TEST_F(PictureLayerImplTest, SharedQuadStateContainsMaxTilingScale) { | 3465 TEST_F(PictureLayerImplTest, SharedQuadStateContainsMaxTilingScale) { |
| 3471 MockOcclusionTracker<LayerImpl> occlusion_tracker; | |
| 3472 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 3466 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
| 3473 | 3467 |
| 3474 gfx::Size tile_size(400, 400); | 3468 gfx::Size tile_size(400, 400); |
| 3475 gfx::Size layer_bounds(1000, 2000); | 3469 gfx::Size layer_bounds(1000, 2000); |
| 3476 | 3470 |
| 3477 scoped_refptr<FakePicturePileImpl> pending_pile = | 3471 scoped_refptr<FakePicturePileImpl> pending_pile = |
| 3478 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 3472 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 3479 scoped_refptr<FakePicturePileImpl> active_pile = | 3473 scoped_refptr<FakePicturePileImpl> active_pile = |
| 3480 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 3474 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 3481 | 3475 |
| 3482 SetupTrees(pending_pile, active_pile); | 3476 SetupTrees(pending_pile, active_pile); |
| 3483 | 3477 |
| 3484 SetupDrawPropertiesAndUpdateTiles(pending_layer_, 2.5f, 1.f, 1.f, 1.f, false); | 3478 SetupDrawPropertiesAndUpdateTiles(pending_layer_, 2.5f, 1.f, 1.f, 1.f, false); |
| 3485 host_impl_.pending_tree()->UpdateDrawProperties(); | 3479 host_impl_.pending_tree()->UpdateDrawProperties(); |
| 3486 | 3480 |
| 3487 active_layer_->draw_properties().visible_content_rect = | 3481 active_layer_->draw_properties().visible_content_rect = |
| 3488 gfx::Rect(layer_bounds); | 3482 gfx::Rect(layer_bounds); |
| 3489 host_impl_.active_tree()->UpdateDrawProperties(); | 3483 host_impl_.active_tree()->UpdateDrawProperties(); |
| 3490 | 3484 |
| 3491 float max_contents_scale = active_layer_->MaximumTilingContentsScale(); | 3485 float max_contents_scale = active_layer_->MaximumTilingContentsScale(); |
| 3492 gfx::Transform scaled_draw_transform = active_layer_->draw_transform(); | 3486 gfx::Transform scaled_draw_transform = active_layer_->draw_transform(); |
| 3493 scaled_draw_transform.Scale(SK_MScalar1 / max_contents_scale, | 3487 scaled_draw_transform.Scale(SK_MScalar1 / max_contents_scale, |
| 3494 SK_MScalar1 / max_contents_scale); | 3488 SK_MScalar1 / max_contents_scale); |
| 3495 | 3489 |
| 3496 AppendQuadsData data; | 3490 AppendQuadsData data; |
| 3497 active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data); | 3491 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); |
| 3498 | 3492 |
| 3499 // SharedQuadState should have be of size 1, as we are doing AppenQuad once. | 3493 // SharedQuadState should have be of size 1, as we are doing AppenQuad once. |
| 3500 EXPECT_EQ(1u, render_pass->shared_quad_state_list.size()); | 3494 EXPECT_EQ(1u, render_pass->shared_quad_state_list.size()); |
| 3501 // The content_to_target_transform should be scaled by the | 3495 // The content_to_target_transform should be scaled by the |
| 3502 // MaximumTilingContentsScale on the layer. | 3496 // MaximumTilingContentsScale on the layer. |
| 3503 EXPECT_EQ(scaled_draw_transform.ToString(), | 3497 EXPECT_EQ(scaled_draw_transform.ToString(), |
| 3504 render_pass->shared_quad_state_list.front() | 3498 render_pass->shared_quad_state_list.front() |
| 3505 ->content_to_target_transform.ToString()); | 3499 ->content_to_target_transform.ToString()); |
| 3506 // The content_bounds should be scaled by the | 3500 // The content_bounds should be scaled by the |
| 3507 // MaximumTilingContentsScale on the layer. | 3501 // MaximumTilingContentsScale on the layer. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3596 size_t max_tiles = 1; | 3590 size_t max_tiles = 1; |
| 3597 size_t memory_limit = max_tiles * 4 * tile_size.width() * tile_size.height(); | 3591 size_t memory_limit = max_tiles * 4 * tile_size.width() * tile_size.height(); |
| 3598 size_t resource_limit = max_tiles; | 3592 size_t resource_limit = max_tiles; |
| 3599 ManagedMemoryPolicy policy(memory_limit, | 3593 ManagedMemoryPolicy policy(memory_limit, |
| 3600 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, | 3594 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, |
| 3601 resource_limit); | 3595 resource_limit); |
| 3602 host_impl_.SetMemoryPolicy(policy); | 3596 host_impl_.SetMemoryPolicy(policy); |
| 3603 host_impl_.SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); | 3597 host_impl_.SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); |
| 3604 host_impl_.ManageTiles(); | 3598 host_impl_.ManageTiles(); |
| 3605 | 3599 |
| 3606 MockOcclusionTracker<LayerImpl> occlusion_tracker; | |
| 3607 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 3600 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
| 3608 AppendQuadsData data; | 3601 AppendQuadsData data; |
| 3609 active_layer_->WillDraw(DRAW_MODE_HARDWARE, NULL); | 3602 active_layer_->WillDraw(DRAW_MODE_HARDWARE, NULL); |
| 3610 active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data); | 3603 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); |
| 3611 active_layer_->DidDraw(NULL); | 3604 active_layer_->DidDraw(NULL); |
| 3612 | 3605 |
| 3613 // Even when OOM, quads should be produced, and should be different material | 3606 // Even when OOM, quads should be produced, and should be different material |
| 3614 // from quads with resource. | 3607 // from quads with resource. |
| 3615 EXPECT_LT(max_tiles, render_pass->quad_list.size()); | 3608 EXPECT_LT(max_tiles, render_pass->quad_list.size()); |
| 3616 EXPECT_EQ(DrawQuad::Material::TILED_CONTENT, | 3609 EXPECT_EQ(DrawQuad::Material::TILED_CONTENT, |
| 3617 render_pass->quad_list.front()->material); | 3610 render_pass->quad_list.front()->material); |
| 3618 EXPECT_EQ(DrawQuad::Material::SOLID_COLOR, | 3611 EXPECT_EQ(DrawQuad::Material::SOLID_COLOR, |
| 3619 render_pass->quad_list.back()->material); | 3612 render_pass->quad_list.back()->material); |
| 3620 } | 3613 } |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4307 ASSERT_TRUE(active_layer_->tilings()); | 4300 ASSERT_TRUE(active_layer_->tilings()); |
| 4308 active_layer_->set_fixed_tile_size(tile_size); | 4301 active_layer_->set_fixed_tile_size(tile_size); |
| 4309 host_impl_.active_tree()->UpdateDrawProperties(); | 4302 host_impl_.active_tree()->UpdateDrawProperties(); |
| 4310 ASSERT_GT(active_layer_->tilings()->num_tilings(), 0u); | 4303 ASSERT_GT(active_layer_->tilings()->num_tilings(), 0u); |
| 4311 std::vector<Tile*> tiles = | 4304 std::vector<Tile*> tiles = |
| 4312 active_layer_->tilings()->tiling_at(0)->AllTilesForTesting(); | 4305 active_layer_->tilings()->tiling_at(0)->AllTilesForTesting(); |
| 4313 EXPECT_FALSE(tiles.empty()); | 4306 EXPECT_FALSE(tiles.empty()); |
| 4314 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); | 4307 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); |
| 4315 } | 4308 } |
| 4316 | 4309 |
| 4317 MockOcclusionTracker<LayerImpl> occlusion_tracker; | |
| 4318 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 4310 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
| 4319 AppendQuadsData data; | 4311 AppendQuadsData data; |
| 4320 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL); | 4312 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL); |
| 4321 active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data); | 4313 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); |
| 4322 active_layer_->DidDraw(NULL); | 4314 active_layer_->DidDraw(NULL); |
| 4323 | 4315 |
| 4324 DrawQuad::Material expected = test_for_solid | 4316 DrawQuad::Material expected = test_for_solid |
| 4325 ? DrawQuad::Material::SOLID_COLOR | 4317 ? DrawQuad::Material::SOLID_COLOR |
| 4326 : DrawQuad::Material::TILED_CONTENT; | 4318 : DrawQuad::Material::TILED_CONTENT; |
| 4327 EXPECT_EQ(expected, render_pass->quad_list.front()->material); | 4319 EXPECT_EQ(expected, render_pass->quad_list.front()->material); |
| 4328 } | 4320 } |
| 4329 | 4321 |
| 4330 TEST_F(PictureLayerImplTest, DrawSolidQuads) { | 4322 TEST_F(PictureLayerImplTest, DrawSolidQuads) { |
| 4331 TestQuadsForSolidColor(true); | 4323 TestQuadsForSolidColor(true); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4402 SetupPendingTree(pending_pile2); | 4394 SetupPendingTree(pending_pile2); |
| 4403 ActivateTree(); | 4395 ActivateTree(); |
| 4404 | 4396 |
| 4405 // We've switched to a solid color, so we should end up with no tilings. | 4397 // We've switched to a solid color, so we should end up with no tilings. |
| 4406 ASSERT_TRUE(active_layer_->tilings()); | 4398 ASSERT_TRUE(active_layer_->tilings()); |
| 4407 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); | 4399 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); |
| 4408 } | 4400 } |
| 4409 | 4401 |
| 4410 } // namespace | 4402 } // namespace |
| 4411 } // namespace cc | 4403 } // namespace cc |
| OLD | NEW |