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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 root_id_(6), | 117 root_id_(6), |
118 id_(7) { | 118 id_(7) { |
119 host_impl_.SetViewportSize(gfx::Size(10000, 10000)); | 119 host_impl_.SetViewportSize(gfx::Size(10000, 10000)); |
120 } | 120 } |
121 | 121 |
122 ~PictureLayerImplTest() override {} | 122 ~PictureLayerImplTest() override {} |
123 | 123 |
124 void SetUp() override { InitializeRenderer(); } | 124 void SetUp() override { InitializeRenderer(); } |
125 | 125 |
126 virtual void InitializeRenderer() { | 126 virtual void InitializeRenderer() { |
| 127 host_impl_.SetVisible(true); |
127 host_impl_.InitializeRenderer(output_surface_.get()); | 128 host_impl_.InitializeRenderer(output_surface_.get()); |
128 } | 129 } |
129 | 130 |
130 void SetupDefaultTrees(const gfx::Size& layer_bounds) { | 131 void SetupDefaultTrees(const gfx::Size& layer_bounds) { |
131 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source = | 132 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source = |
132 FakeDisplayListRasterSource::CreateFilled(layer_bounds); | 133 FakeDisplayListRasterSource::CreateFilled(layer_bounds); |
133 scoped_refptr<FakeDisplayListRasterSource> active_raster_source = | 134 scoped_refptr<FakeDisplayListRasterSource> active_raster_source = |
134 FakeDisplayListRasterSource::CreateFilled(layer_bounds); | 135 FakeDisplayListRasterSource::CreateFilled(layer_bounds); |
135 | 136 |
136 SetupTrees(pending_raster_source, active_raster_source); | 137 SetupTrees(pending_raster_source, active_raster_source); |
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1563 | 1564 |
1564 ResetTilingsAndRasterScales(); | 1565 ResetTilingsAndRasterScales(); |
1565 | 1566 |
1566 // Change the max texture size on the output surface context. | 1567 // Change the max texture size on the output surface context. |
1567 scoped_ptr<TestWebGraphicsContext3D> context = | 1568 scoped_ptr<TestWebGraphicsContext3D> context = |
1568 TestWebGraphicsContext3D::Create(); | 1569 TestWebGraphicsContext3D::Create(); |
1569 context->set_max_texture_size(140); | 1570 context->set_max_texture_size(140); |
1570 host_impl_.DidLoseOutputSurface(); | 1571 host_impl_.DidLoseOutputSurface(); |
1571 scoped_ptr<OutputSurface> new_output_surface = | 1572 scoped_ptr<OutputSurface> new_output_surface = |
1572 FakeOutputSurface::Create3d(context.Pass()); | 1573 FakeOutputSurface::Create3d(context.Pass()); |
| 1574 host_impl_.SetVisible(true); |
1573 host_impl_.InitializeRenderer(new_output_surface.get()); | 1575 host_impl_.InitializeRenderer(new_output_surface.get()); |
1574 output_surface_ = new_output_surface.Pass(); | 1576 output_surface_ = new_output_surface.Pass(); |
1575 | 1577 |
1576 SetupDrawPropertiesAndUpdateTiles(pending_layer_, 1.f, 1.f, 1.f, 1.f, 0.f, | 1578 SetupDrawPropertiesAndUpdateTiles(pending_layer_, 1.f, 1.f, 1.f, 1.f, 0.f, |
1577 false); | 1579 false); |
1578 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings()); | 1580 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings()); |
1579 | 1581 |
1580 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); | 1582 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); |
1581 | 1583 |
1582 // Verify the tiles are not larger than the context's max texture size. | 1584 // Verify the tiles are not larger than the context's max texture size. |
(...skipping 19 matching lines...) Expand all Loading... |
1602 | 1604 |
1603 ResetTilingsAndRasterScales(); | 1605 ResetTilingsAndRasterScales(); |
1604 | 1606 |
1605 // Change the max texture size on the output surface context. | 1607 // Change the max texture size on the output surface context. |
1606 scoped_ptr<TestWebGraphicsContext3D> context = | 1608 scoped_ptr<TestWebGraphicsContext3D> context = |
1607 TestWebGraphicsContext3D::Create(); | 1609 TestWebGraphicsContext3D::Create(); |
1608 context->set_max_texture_size(140); | 1610 context->set_max_texture_size(140); |
1609 host_impl_.DidLoseOutputSurface(); | 1611 host_impl_.DidLoseOutputSurface(); |
1610 scoped_ptr<OutputSurface> new_output_surface = | 1612 scoped_ptr<OutputSurface> new_output_surface = |
1611 FakeOutputSurface::Create3d(context.Pass()); | 1613 FakeOutputSurface::Create3d(context.Pass()); |
| 1614 host_impl_.SetVisible(true); |
1612 host_impl_.InitializeRenderer(new_output_surface.get()); | 1615 host_impl_.InitializeRenderer(new_output_surface.get()); |
1613 output_surface_ = new_output_surface.Pass(); | 1616 output_surface_ = new_output_surface.Pass(); |
1614 | 1617 |
1615 SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, 1.f, 1.f, 1.f, 0.f, | 1618 SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, 1.f, 1.f, 1.f, 0.f, |
1616 false); | 1619 false); |
1617 ASSERT_LE(1u, active_layer_->tilings()->num_tilings()); | 1620 ASSERT_LE(1u, active_layer_->tilings()->num_tilings()); |
1618 | 1621 |
1619 active_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); | 1622 active_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); |
1620 | 1623 |
1621 // There should be more than one tile since the max texture size won't cover | 1624 // There should be more than one tile since the max texture size won't cover |
(...skipping 2187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3809 ->visible_quad_layer_rect.ToString()); | 3812 ->visible_quad_layer_rect.ToString()); |
3810 } | 3813 } |
3811 | 3814 |
3812 class PictureLayerImplTestWithDelegatingRenderer : public PictureLayerImplTest { | 3815 class PictureLayerImplTestWithDelegatingRenderer : public PictureLayerImplTest { |
3813 public: | 3816 public: |
3814 PictureLayerImplTestWithDelegatingRenderer() : PictureLayerImplTest() { | 3817 PictureLayerImplTestWithDelegatingRenderer() : PictureLayerImplTest() { |
3815 output_surface_ = FakeOutputSurface::CreateDelegating3d(); | 3818 output_surface_ = FakeOutputSurface::CreateDelegating3d(); |
3816 } | 3819 } |
3817 | 3820 |
3818 void InitializeRenderer() override { | 3821 void InitializeRenderer() override { |
| 3822 host_impl_.SetVisible(true); |
3819 host_impl_.InitializeRenderer(output_surface_.get()); | 3823 host_impl_.InitializeRenderer(output_surface_.get()); |
3820 } | 3824 } |
3821 }; | 3825 }; |
3822 | 3826 |
3823 TEST_F(PictureLayerImplTestWithDelegatingRenderer, | 3827 TEST_F(PictureLayerImplTestWithDelegatingRenderer, |
3824 DelegatingRendererWithTileOOM) { | 3828 DelegatingRendererWithTileOOM) { |
3825 // This test is added for crbug.com/402321, where quad should be produced when | 3829 // This test is added for crbug.com/402321, where quad should be produced when |
3826 // raster on demand is not allowed and tile is OOM. | 3830 // raster on demand is not allowed and tile is OOM. |
3827 gfx::Size layer_bounds(1000, 1000); | 3831 gfx::Size layer_bounds(1000, 1000); |
3828 | 3832 |
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5019 // New low res tiling. | 5023 // New low res tiling. |
5020 EXPECT_TRUE(tilings->tiling_at(2)->may_contain_low_resolution_tiles()); | 5024 EXPECT_TRUE(tilings->tiling_at(2)->may_contain_low_resolution_tiles()); |
5021 | 5025 |
5022 // This tiling will be high res now, it won't contain low res content since it | 5026 // This tiling will be high res now, it won't contain low res content since it |
5023 // was all destroyed. | 5027 // was all destroyed. |
5024 EXPECT_FALSE(tilings->tiling_at(1)->may_contain_low_resolution_tiles()); | 5028 EXPECT_FALSE(tilings->tiling_at(1)->may_contain_low_resolution_tiles()); |
5025 } | 5029 } |
5026 | 5030 |
5027 } // namespace | 5031 } // namespace |
5028 } // namespace cc | 5032 } // namespace cc |
OLD | NEW |