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 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1497 // This should create new tilings. | 1497 // This should create new tilings. |
1498 SetupDrawPropertiesAndUpdateTiles(pending_layer_, | 1498 SetupDrawPropertiesAndUpdateTiles(pending_layer_, |
1499 1.f, // ideal contents scale | 1499 1.f, // ideal contents scale |
1500 1.f, // device scale | 1500 1.f, // device scale |
1501 1.f, // page scale | 1501 1.f, // page scale |
1502 1.f, // maximum animation scale | 1502 1.f, // maximum animation scale |
1503 false); | 1503 false); |
1504 EXPECT_EQ(2u, pending_layer_->tilings()->num_tilings()); | 1504 EXPECT_EQ(2u, pending_layer_->tilings()->num_tilings()); |
1505 } | 1505 } |
1506 | 1506 |
1507 TEST_F(PictureLayerImplTest, ClampTilesToToMaxTileSize) { | 1507 TEST_F(PictureLayerImplTest, ClampTilesToMaxTileSize) { |
1508 // The default max tile size is larger than 400x400. | 1508 // The default max tile size is larger than 400x400. |
1509 gfx::Size tile_size(400, 400); | 1509 gfx::Size tile_size(400, 400); |
1510 gfx::Size layer_bounds(5000, 5000); | 1510 gfx::Size layer_bounds(5000, 5000); |
1511 | 1511 |
1512 scoped_refptr<FakePicturePileImpl> pending_pile = | 1512 scoped_refptr<FakePicturePileImpl> pending_pile = |
1513 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1513 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
1514 scoped_refptr<FakePicturePileImpl> active_pile = | 1514 scoped_refptr<FakePicturePileImpl> active_pile = |
1515 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1515 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
1516 | 1516 |
1517 SetupTrees(pending_pile, active_pile); | 1517 SetupTrees(pending_pile, active_pile); |
(...skipping 3368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4886 | 4886 |
4887 class TileSizeTest : public PictureLayerImplTest { | 4887 class TileSizeTest : public PictureLayerImplTest { |
4888 public: | 4888 public: |
4889 TileSizeTest() : PictureLayerImplTest(TileSizeSettings()) {} | 4889 TileSizeTest() : PictureLayerImplTest(TileSizeSettings()) {} |
4890 }; | 4890 }; |
4891 | 4891 |
4892 TEST_F(TileSizeTest, TileSizes) { | 4892 TEST_F(TileSizeTest, TileSizes) { |
4893 host_impl_.CreatePendingTree(); | 4893 host_impl_.CreatePendingTree(); |
4894 | 4894 |
4895 LayerTreeImpl* pending_tree = host_impl_.pending_tree(); | 4895 LayerTreeImpl* pending_tree = host_impl_.pending_tree(); |
4896 scoped_ptr<FakePictureLayerImpl> layer = | 4896 scoped_ptr<FakePictureLayerImpl> scoped_layer = |
4897 FakePictureLayerImpl::Create(pending_tree, id_); | 4897 FakePictureLayerImpl::Create(pending_tree, id_); |
| 4898 FakePictureLayerImpl* layer = scoped_layer.get(); |
| 4899 pending_tree->SetRootLayer(scoped_layer.Pass()); |
4898 | 4900 |
4899 host_impl_.SetViewportSize(gfx::Size(1000, 1000)); | 4901 host_impl_.SetViewportSize(gfx::Size(1000, 1000)); |
4900 gfx::Size result; | 4902 gfx::Size result; |
4901 | 4903 |
4902 host_impl_.SetUseGpuRasterization(false); | 4904 host_impl_.SetUseGpuRasterization(false); |
4903 | 4905 |
4904 // Default tile-size for large layers. | 4906 // Default tile-size for large layers. |
4905 result = layer->CalculateTileSize(gfx::Size(10000, 10000)); | 4907 result = layer->CalculateTileSize(gfx::Size(10000, 10000)); |
4906 EXPECT_EQ(result.width(), 100); | 4908 EXPECT_EQ(result.width(), 100); |
4907 EXPECT_EQ(result.height(), 100); | 4909 EXPECT_EQ(result.height(), 100); |
(...skipping 28 matching lines...) Expand all Loading... |
4936 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4938 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
4937 EXPECT_EQ(result.width(), 448); | 4939 EXPECT_EQ(result.width(), 448); |
4938 EXPECT_EQ(result.height(), 448); | 4940 EXPECT_EQ(result.height(), 448); |
4939 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4941 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
4940 EXPECT_EQ(result.width(), 512); | 4942 EXPECT_EQ(result.width(), 512); |
4941 EXPECT_EQ(result.height(), 500 + 2); | 4943 EXPECT_EQ(result.height(), 500 + 2); |
4942 } | 4944 } |
4943 | 4945 |
4944 } // namespace | 4946 } // namespace |
4945 } // namespace cc | 4947 } // namespace cc |
OLD | NEW |