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 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1609 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1609 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
1610 | 1610 |
1611 gfx::Rect layer_invalidation(150, 200, 30, 180); | 1611 gfx::Rect layer_invalidation(150, 200, 30, 180); |
1612 SetupTreesWithInvalidation(pending_pile, active_pile, layer_invalidation); | 1612 SetupTreesWithInvalidation(pending_pile, active_pile, layer_invalidation); |
1613 | 1613 |
1614 active_layer_->draw_properties().visible_content_rect = | 1614 active_layer_->draw_properties().visible_content_rect = |
1615 gfx::Rect(layer_bounds); | 1615 gfx::Rect(layer_bounds); |
1616 | 1616 |
1617 AppendQuadsData data; | 1617 AppendQuadsData data; |
1618 active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, nullptr); | 1618 active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, nullptr); |
1619 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); | 1619 active_layer_->AppendQuads(render_pass.get(), &data); |
1620 active_layer_->DidDraw(nullptr); | 1620 active_layer_->DidDraw(nullptr); |
1621 | 1621 |
1622 ASSERT_EQ(1U, render_pass->quad_list.size()); | 1622 ASSERT_EQ(1U, render_pass->quad_list.size()); |
1623 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, | 1623 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, |
1624 render_pass->quad_list.front()->material); | 1624 render_pass->quad_list.front()->material); |
1625 } | 1625 } |
1626 | 1626 |
1627 TEST_F(PictureLayerImplTest, SolidColorLayerHasVisibleFullCoverage) { | 1627 TEST_F(PictureLayerImplTest, SolidColorLayerHasVisibleFullCoverage) { |
1628 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 1628 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
1629 | 1629 |
1630 gfx::Size tile_size(1000, 1000); | 1630 gfx::Size tile_size(1000, 1000); |
1631 gfx::Size layer_bounds(1500, 1500); | 1631 gfx::Size layer_bounds(1500, 1500); |
1632 gfx::Rect visible_rect(250, 250, 1000, 1000); | 1632 gfx::Rect visible_rect(250, 250, 1000, 1000); |
1633 | 1633 |
1634 scoped_refptr<FakePicturePileImpl> pending_pile = | 1634 scoped_refptr<FakePicturePileImpl> pending_pile = |
1635 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); | 1635 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); |
1636 scoped_refptr<FakePicturePileImpl> active_pile = | 1636 scoped_refptr<FakePicturePileImpl> active_pile = |
1637 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); | 1637 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); |
1638 | 1638 |
1639 pending_pile->set_is_solid_color(true); | 1639 pending_pile->set_is_solid_color(true); |
1640 active_pile->set_is_solid_color(true); | 1640 active_pile->set_is_solid_color(true); |
1641 | 1641 |
1642 SetupTrees(pending_pile, active_pile); | 1642 SetupTrees(pending_pile, active_pile); |
1643 | 1643 |
1644 active_layer_->draw_properties().visible_content_rect = visible_rect; | 1644 active_layer_->draw_properties().visible_content_rect = visible_rect; |
1645 | 1645 |
1646 AppendQuadsData data; | 1646 AppendQuadsData data; |
1647 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); | 1647 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); |
1648 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); | 1648 active_layer_->AppendQuads(render_pass.get(), &data); |
1649 active_layer_->DidDraw(nullptr); | 1649 active_layer_->DidDraw(nullptr); |
1650 | 1650 |
1651 Region remaining = visible_rect; | 1651 Region remaining = visible_rect; |
1652 for (const auto& quad : render_pass->quad_list) { | 1652 for (const auto& quad : render_pass->quad_list) { |
1653 EXPECT_TRUE(visible_rect.Contains(quad->rect)); | 1653 EXPECT_TRUE(visible_rect.Contains(quad->rect)); |
1654 EXPECT_TRUE(remaining.Contains(quad->rect)); | 1654 EXPECT_TRUE(remaining.Contains(quad->rect)); |
1655 remaining.Subtract(quad->rect); | 1655 remaining.Subtract(quad->rect); |
1656 } | 1656 } |
1657 | 1657 |
1658 EXPECT_TRUE(remaining.IsEmpty()); | 1658 EXPECT_TRUE(remaining.IsEmpty()); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1804 EXPECT_GT(num_outside, 0); | 1804 EXPECT_GT(num_outside, 0); |
1805 | 1805 |
1806 // Activate and draw active layer. | 1806 // Activate and draw active layer. |
1807 host_impl_.ActivateSyncTree(); | 1807 host_impl_.ActivateSyncTree(); |
1808 host_impl_.active_tree()->UpdateDrawProperties(); | 1808 host_impl_.active_tree()->UpdateDrawProperties(); |
1809 active_layer_->draw_properties().visible_content_rect = visible_content_rect; | 1809 active_layer_->draw_properties().visible_content_rect = visible_content_rect; |
1810 | 1810 |
1811 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 1811 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
1812 AppendQuadsData data; | 1812 AppendQuadsData data; |
1813 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); | 1813 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); |
1814 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); | 1814 active_layer_->AppendQuads(render_pass.get(), &data); |
1815 active_layer_->DidDraw(nullptr); | 1815 active_layer_->DidDraw(nullptr); |
1816 | 1816 |
1817 // All tiles in activation rect is ready to draw. | 1817 // All tiles in activation rect is ready to draw. |
1818 EXPECT_EQ(0u, data.num_missing_tiles); | 1818 EXPECT_EQ(0u, data.num_missing_tiles); |
1819 EXPECT_EQ(0u, data.num_incomplete_tiles); | 1819 EXPECT_EQ(0u, data.num_incomplete_tiles); |
1820 EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads()); | 1820 EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads()); |
1821 } | 1821 } |
1822 | 1822 |
1823 TEST_F(PictureLayerImplTest, HighResTileIsComplete) { | 1823 TEST_F(PictureLayerImplTest, HighResTileIsComplete) { |
1824 base::TimeTicks time_ticks; | 1824 base::TimeTicks time_ticks; |
(...skipping 11 matching lines...) Expand all Loading... |
1836 ActivateTree(); | 1836 ActivateTree(); |
1837 | 1837 |
1838 // All high res tiles have resources. | 1838 // All high res tiles have resources. |
1839 std::vector<Tile*> tiles = | 1839 std::vector<Tile*> tiles = |
1840 active_layer_->tilings()->tiling_at(0)->AllTilesForTesting(); | 1840 active_layer_->tilings()->tiling_at(0)->AllTilesForTesting(); |
1841 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); | 1841 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); |
1842 | 1842 |
1843 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 1843 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
1844 AppendQuadsData data; | 1844 AppendQuadsData data; |
1845 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); | 1845 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); |
1846 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); | 1846 active_layer_->AppendQuads(render_pass.get(), &data); |
1847 active_layer_->DidDraw(nullptr); | 1847 active_layer_->DidDraw(nullptr); |
1848 | 1848 |
1849 // All high res tiles drew, nothing was incomplete. | 1849 // All high res tiles drew, nothing was incomplete. |
1850 EXPECT_EQ(9u, render_pass->quad_list.size()); | 1850 EXPECT_EQ(9u, render_pass->quad_list.size()); |
1851 EXPECT_EQ(0u, data.num_missing_tiles); | 1851 EXPECT_EQ(0u, data.num_missing_tiles); |
1852 EXPECT_EQ(0u, data.num_incomplete_tiles); | 1852 EXPECT_EQ(0u, data.num_incomplete_tiles); |
1853 EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads()); | 1853 EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads()); |
1854 } | 1854 } |
1855 | 1855 |
1856 TEST_F(PictureLayerImplTest, HighResTileIsIncomplete) { | 1856 TEST_F(PictureLayerImplTest, HighResTileIsIncomplete) { |
1857 base::TimeTicks time_ticks; | 1857 base::TimeTicks time_ticks; |
1858 time_ticks += base::TimeDelta::FromMilliseconds(1); | 1858 time_ticks += base::TimeDelta::FromMilliseconds(1); |
1859 host_impl_.SetCurrentBeginFrameArgs( | 1859 host_impl_.SetCurrentBeginFrameArgs( |
1860 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); | 1860 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
1861 | 1861 |
1862 gfx::Size tile_size(100, 100); | 1862 gfx::Size tile_size(100, 100); |
1863 gfx::Size layer_bounds(200, 200); | 1863 gfx::Size layer_bounds(200, 200); |
1864 | 1864 |
1865 scoped_refptr<FakePicturePileImpl> pending_pile = | 1865 scoped_refptr<FakePicturePileImpl> pending_pile = |
1866 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1866 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
1867 SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region()); | 1867 SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region()); |
1868 ActivateTree(); | 1868 ActivateTree(); |
1869 | 1869 |
1870 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 1870 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
1871 AppendQuadsData data; | 1871 AppendQuadsData data; |
1872 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); | 1872 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); |
1873 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); | 1873 active_layer_->AppendQuads(render_pass.get(), &data); |
1874 active_layer_->DidDraw(nullptr); | 1874 active_layer_->DidDraw(nullptr); |
1875 | 1875 |
1876 EXPECT_EQ(1u, render_pass->quad_list.size()); | 1876 EXPECT_EQ(1u, render_pass->quad_list.size()); |
1877 EXPECT_EQ(1u, data.num_missing_tiles); | 1877 EXPECT_EQ(1u, data.num_missing_tiles); |
1878 EXPECT_EQ(0u, data.num_incomplete_tiles); | 1878 EXPECT_EQ(0u, data.num_incomplete_tiles); |
1879 EXPECT_TRUE(active_layer_->only_used_low_res_last_append_quads()); | 1879 EXPECT_TRUE(active_layer_->only_used_low_res_last_append_quads()); |
1880 } | 1880 } |
1881 | 1881 |
1882 TEST_F(PictureLayerImplTest, HighResTileIsIncompleteLowResComplete) { | 1882 TEST_F(PictureLayerImplTest, HighResTileIsIncompleteLowResComplete) { |
1883 base::TimeTicks time_ticks; | 1883 base::TimeTicks time_ticks; |
1884 time_ticks += base::TimeDelta::FromMilliseconds(1); | 1884 time_ticks += base::TimeDelta::FromMilliseconds(1); |
1885 host_impl_.SetCurrentBeginFrameArgs( | 1885 host_impl_.SetCurrentBeginFrameArgs( |
1886 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); | 1886 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
1887 | 1887 |
1888 gfx::Size tile_size(100, 100); | 1888 gfx::Size tile_size(100, 100); |
1889 gfx::Size layer_bounds(200, 200); | 1889 gfx::Size layer_bounds(200, 200); |
1890 | 1890 |
1891 scoped_refptr<FakePicturePileImpl> pending_pile = | 1891 scoped_refptr<FakePicturePileImpl> pending_pile = |
1892 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1892 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
1893 SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region()); | 1893 SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region()); |
1894 ActivateTree(); | 1894 ActivateTree(); |
1895 | 1895 |
1896 std::vector<Tile*> low_tiles = | 1896 std::vector<Tile*> low_tiles = |
1897 active_layer_->tilings()->tiling_at(1)->AllTilesForTesting(); | 1897 active_layer_->tilings()->tiling_at(1)->AllTilesForTesting(); |
1898 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(low_tiles); | 1898 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(low_tiles); |
1899 | 1899 |
1900 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 1900 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
1901 AppendQuadsData data; | 1901 AppendQuadsData data; |
1902 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); | 1902 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); |
1903 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); | 1903 active_layer_->AppendQuads(render_pass.get(), &data); |
1904 active_layer_->DidDraw(nullptr); | 1904 active_layer_->DidDraw(nullptr); |
1905 | 1905 |
1906 EXPECT_EQ(1u, render_pass->quad_list.size()); | 1906 EXPECT_EQ(1u, render_pass->quad_list.size()); |
1907 EXPECT_EQ(0u, data.num_missing_tiles); | 1907 EXPECT_EQ(0u, data.num_missing_tiles); |
1908 EXPECT_EQ(1u, data.num_incomplete_tiles); | 1908 EXPECT_EQ(1u, data.num_incomplete_tiles); |
1909 EXPECT_TRUE(active_layer_->only_used_low_res_last_append_quads()); | 1909 EXPECT_TRUE(active_layer_->only_used_low_res_last_append_quads()); |
1910 } | 1910 } |
1911 | 1911 |
1912 TEST_F(PictureLayerImplTest, LowResTileIsIncomplete) { | 1912 TEST_F(PictureLayerImplTest, LowResTileIsIncomplete) { |
1913 base::TimeTicks time_ticks; | 1913 base::TimeTicks time_ticks; |
(...skipping 16 matching lines...) Expand all Loading... |
1930 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(high_tiles); | 1930 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(high_tiles); |
1931 | 1931 |
1932 // All low res tiles have resources. | 1932 // All low res tiles have resources. |
1933 std::vector<Tile*> low_tiles = | 1933 std::vector<Tile*> low_tiles = |
1934 active_layer_->tilings()->tiling_at(1)->AllTilesForTesting(); | 1934 active_layer_->tilings()->tiling_at(1)->AllTilesForTesting(); |
1935 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(low_tiles); | 1935 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(low_tiles); |
1936 | 1936 |
1937 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 1937 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
1938 AppendQuadsData data; | 1938 AppendQuadsData data; |
1939 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); | 1939 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); |
1940 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); | 1940 active_layer_->AppendQuads(render_pass.get(), &data); |
1941 active_layer_->DidDraw(nullptr); | 1941 active_layer_->DidDraw(nullptr); |
1942 | 1942 |
1943 // The missing high res tile was replaced by a low res tile. | 1943 // The missing high res tile was replaced by a low res tile. |
1944 EXPECT_EQ(9u, render_pass->quad_list.size()); | 1944 EXPECT_EQ(9u, render_pass->quad_list.size()); |
1945 EXPECT_EQ(0u, data.num_missing_tiles); | 1945 EXPECT_EQ(0u, data.num_missing_tiles); |
1946 EXPECT_EQ(1u, data.num_incomplete_tiles); | 1946 EXPECT_EQ(1u, data.num_incomplete_tiles); |
1947 EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads()); | 1947 EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads()); |
1948 } | 1948 } |
1949 | 1949 |
1950 TEST_F(PictureLayerImplTest, | 1950 TEST_F(PictureLayerImplTest, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1988 EXPECT_EQ(1.f, active_layer_->tilings()->tiling_at(1)->contents_scale()); | 1988 EXPECT_EQ(1.f, active_layer_->tilings()->tiling_at(1)->contents_scale()); |
1989 | 1989 |
1990 // All high res tiles have resources. | 1990 // All high res tiles have resources. |
1991 std::vector<Tile*> high_tiles = | 1991 std::vector<Tile*> high_tiles = |
1992 active_layer_->HighResTiling()->AllTilesForTesting(); | 1992 active_layer_->HighResTiling()->AllTilesForTesting(); |
1993 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(high_tiles); | 1993 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(high_tiles); |
1994 | 1994 |
1995 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 1995 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
1996 AppendQuadsData data; | 1996 AppendQuadsData data; |
1997 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); | 1997 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); |
1998 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); | 1998 active_layer_->AppendQuads(render_pass.get(), &data); |
1999 active_layer_->DidDraw(nullptr); | 1999 active_layer_->DidDraw(nullptr); |
2000 | 2000 |
2001 // All high res tiles drew, and the one ideal res tile drew. | 2001 // All high res tiles drew, and the one ideal res tile drew. |
2002 ASSERT_GT(render_pass->quad_list.size(), 9u); | 2002 ASSERT_GT(render_pass->quad_list.size(), 9u); |
2003 EXPECT_EQ(gfx::SizeF(99.f, 99.f), | 2003 EXPECT_EQ(gfx::SizeF(99.f, 99.f), |
2004 TileDrawQuad::MaterialCast(render_pass->quad_list.front()) | 2004 TileDrawQuad::MaterialCast(render_pass->quad_list.front()) |
2005 ->tex_coord_rect.size()); | 2005 ->tex_coord_rect.size()); |
2006 EXPECT_EQ(gfx::SizeF(49.5f, 49.5f), | 2006 EXPECT_EQ(gfx::SizeF(49.5f, 49.5f), |
2007 TileDrawQuad::MaterialCast(render_pass->quad_list.ElementAt(1)) | 2007 TileDrawQuad::MaterialCast(render_pass->quad_list.ElementAt(1)) |
2008 ->tex_coord_rect.size()); | 2008 ->tex_coord_rect.size()); |
(...skipping 1785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3794 SetupDrawPropertiesAndUpdateTiles(active_layer_, 2.5f, 1.f, 1.f, 1.f, false); | 3794 SetupDrawPropertiesAndUpdateTiles(active_layer_, 2.5f, 1.f, 1.f, 1.f, false); |
3795 | 3795 |
3796 float max_contents_scale = active_layer_->MaximumTilingContentsScale(); | 3796 float max_contents_scale = active_layer_->MaximumTilingContentsScale(); |
3797 EXPECT_EQ(2.5f, max_contents_scale); | 3797 EXPECT_EQ(2.5f, max_contents_scale); |
3798 | 3798 |
3799 gfx::Transform scaled_draw_transform = active_layer_->draw_transform(); | 3799 gfx::Transform scaled_draw_transform = active_layer_->draw_transform(); |
3800 scaled_draw_transform.Scale(SK_MScalar1 / max_contents_scale, | 3800 scaled_draw_transform.Scale(SK_MScalar1 / max_contents_scale, |
3801 SK_MScalar1 / max_contents_scale); | 3801 SK_MScalar1 / max_contents_scale); |
3802 | 3802 |
3803 AppendQuadsData data; | 3803 AppendQuadsData data; |
3804 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); | 3804 active_layer_->AppendQuads(render_pass.get(), &data); |
3805 | 3805 |
3806 // SharedQuadState should have be of size 1, as we are doing AppenQuad once. | 3806 // SharedQuadState should have be of size 1, as we are doing AppenQuad once. |
3807 EXPECT_EQ(1u, render_pass->shared_quad_state_list.size()); | 3807 EXPECT_EQ(1u, render_pass->shared_quad_state_list.size()); |
3808 // The content_to_target_transform should be scaled by the | 3808 // The content_to_target_transform should be scaled by the |
3809 // MaximumTilingContentsScale on the layer. | 3809 // MaximumTilingContentsScale on the layer. |
3810 EXPECT_EQ(scaled_draw_transform.ToString(), | 3810 EXPECT_EQ(scaled_draw_transform.ToString(), |
3811 render_pass->shared_quad_state_list.front() | 3811 render_pass->shared_quad_state_list.front() |
3812 ->content_to_target_transform.ToString()); | 3812 ->content_to_target_transform.ToString()); |
3813 // The content_bounds should be scaled by the | 3813 // The content_bounds should be scaled by the |
3814 // MaximumTilingContentsScale on the layer. | 3814 // MaximumTilingContentsScale on the layer. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3860 ManagedMemoryPolicy policy(memory_limit, | 3860 ManagedMemoryPolicy policy(memory_limit, |
3861 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, | 3861 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, |
3862 resource_limit); | 3862 resource_limit); |
3863 host_impl_.SetMemoryPolicy(policy); | 3863 host_impl_.SetMemoryPolicy(policy); |
3864 host_impl_.SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); | 3864 host_impl_.SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); |
3865 host_impl_.PrepareTiles(); | 3865 host_impl_.PrepareTiles(); |
3866 | 3866 |
3867 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 3867 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
3868 AppendQuadsData data; | 3868 AppendQuadsData data; |
3869 active_layer_->WillDraw(DRAW_MODE_HARDWARE, nullptr); | 3869 active_layer_->WillDraw(DRAW_MODE_HARDWARE, nullptr); |
3870 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); | 3870 active_layer_->AppendQuads(render_pass.get(), &data); |
3871 active_layer_->DidDraw(nullptr); | 3871 active_layer_->DidDraw(nullptr); |
3872 | 3872 |
3873 // Even when OOM, quads should be produced, and should be different material | 3873 // Even when OOM, quads should be produced, and should be different material |
3874 // from quads with resource. | 3874 // from quads with resource. |
3875 EXPECT_LT(max_tiles, render_pass->quad_list.size()); | 3875 EXPECT_LT(max_tiles, render_pass->quad_list.size()); |
3876 EXPECT_EQ(DrawQuad::Material::TILED_CONTENT, | 3876 EXPECT_EQ(DrawQuad::Material::TILED_CONTENT, |
3877 render_pass->quad_list.front()->material); | 3877 render_pass->quad_list.front()->material); |
3878 EXPECT_EQ(DrawQuad::Material::SOLID_COLOR, | 3878 EXPECT_EQ(DrawQuad::Material::SOLID_COLOR, |
3879 render_pass->quad_list.back()->material); | 3879 render_pass->quad_list.back()->material); |
3880 } | 3880 } |
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4675 ASSERT_GT(active_layer_->tilings()->num_tilings(), 0u); | 4675 ASSERT_GT(active_layer_->tilings()->num_tilings(), 0u); |
4676 std::vector<Tile*> tiles = | 4676 std::vector<Tile*> tiles = |
4677 active_layer_->tilings()->tiling_at(0)->AllTilesForTesting(); | 4677 active_layer_->tilings()->tiling_at(0)->AllTilesForTesting(); |
4678 EXPECT_FALSE(tiles.empty()); | 4678 EXPECT_FALSE(tiles.empty()); |
4679 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); | 4679 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); |
4680 } | 4680 } |
4681 | 4681 |
4682 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 4682 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
4683 AppendQuadsData data; | 4683 AppendQuadsData data; |
4684 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); | 4684 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); |
4685 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); | 4685 active_layer_->AppendQuads(render_pass.get(), &data); |
4686 active_layer_->DidDraw(nullptr); | 4686 active_layer_->DidDraw(nullptr); |
4687 | 4687 |
4688 DrawQuad::Material expected = test_for_solid | 4688 DrawQuad::Material expected = test_for_solid |
4689 ? DrawQuad::Material::SOLID_COLOR | 4689 ? DrawQuad::Material::SOLID_COLOR |
4690 : DrawQuad::Material::TILED_CONTENT; | 4690 : DrawQuad::Material::TILED_CONTENT; |
4691 EXPECT_EQ(expected, render_pass->quad_list.front()->material); | 4691 EXPECT_EQ(expected, render_pass->quad_list.front()->material); |
4692 } | 4692 } |
4693 | 4693 |
4694 TEST_F(PictureLayerImplTest, DrawSolidQuads) { | 4694 TEST_F(PictureLayerImplTest, DrawSolidQuads) { |
4695 TestQuadsForSolidColor(true); | 4695 TestQuadsForSolidColor(true); |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4933 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4933 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
4934 EXPECT_EQ(result.width(), 448); | 4934 EXPECT_EQ(result.width(), 448); |
4935 EXPECT_EQ(result.height(), 448); | 4935 EXPECT_EQ(result.height(), 448); |
4936 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4936 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
4937 EXPECT_EQ(result.width(), 512); | 4937 EXPECT_EQ(result.width(), 512); |
4938 EXPECT_EQ(result.height(), 500 + 2); | 4938 EXPECT_EQ(result.height(), 500 + 2); |
4939 } | 4939 } |
4940 | 4940 |
4941 } // namespace | 4941 } // namespace |
4942 } // namespace cc | 4942 } // namespace cc |
OLD | NEW |