| 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 3366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4884 | 4884 |
| 4885 class TileSizeTest : public PictureLayerImplTest { | 4885 class TileSizeTest : public PictureLayerImplTest { |
| 4886 public: | 4886 public: |
| 4887 TileSizeTest() : PictureLayerImplTest(TileSizeSettings()) {} | 4887 TileSizeTest() : PictureLayerImplTest(TileSizeSettings()) {} |
| 4888 }; | 4888 }; |
| 4889 | 4889 |
| 4890 TEST_F(TileSizeTest, TileSizes) { | 4890 TEST_F(TileSizeTest, TileSizes) { |
| 4891 host_impl_.CreatePendingTree(); | 4891 host_impl_.CreatePendingTree(); |
| 4892 | 4892 |
| 4893 LayerTreeImpl* pending_tree = host_impl_.pending_tree(); | 4893 LayerTreeImpl* pending_tree = host_impl_.pending_tree(); |
| 4894 scoped_ptr<FakePictureLayerImpl> layer = | 4894 scoped_ptr<FakePictureLayerImpl> scoped_layer = |
| 4895 FakePictureLayerImpl::Create(pending_tree, id_); | 4895 FakePictureLayerImpl::Create(pending_tree, id_); |
| 4896 FakePictureLayerImpl* layer = scoped_layer.get(); |
| 4897 pending_tree->SetRootLayer(scoped_layer.Pass()); |
| 4896 | 4898 |
| 4897 host_impl_.SetViewportSize(gfx::Size(1000, 1000)); | 4899 host_impl_.SetViewportSize(gfx::Size(1000, 1000)); |
| 4898 gfx::Size result; | 4900 gfx::Size result; |
| 4899 | 4901 |
| 4900 host_impl_.SetUseGpuRasterization(false); | 4902 host_impl_.SetUseGpuRasterization(false); |
| 4901 | 4903 |
| 4902 // Default tile-size for large layers. | 4904 // Default tile-size for large layers. |
| 4903 result = layer->CalculateTileSize(gfx::Size(10000, 10000)); | 4905 result = layer->CalculateTileSize(gfx::Size(10000, 10000)); |
| 4904 EXPECT_EQ(result.width(), 100); | 4906 EXPECT_EQ(result.width(), 100); |
| 4905 EXPECT_EQ(result.height(), 100); | 4907 EXPECT_EQ(result.height(), 100); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 4934 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4936 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
| 4935 EXPECT_EQ(result.width(), 448); | 4937 EXPECT_EQ(result.width(), 448); |
| 4936 EXPECT_EQ(result.height(), 448); | 4938 EXPECT_EQ(result.height(), 448); |
| 4937 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4939 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
| 4938 EXPECT_EQ(result.width(), 512); | 4940 EXPECT_EQ(result.width(), 512); |
| 4939 EXPECT_EQ(result.height(), 500 + 2); | 4941 EXPECT_EQ(result.height(), 500 + 2); |
| 4940 } | 4942 } |
| 4941 | 4943 |
| 4942 } // namespace | 4944 } // namespace |
| 4943 } // namespace cc | 4945 } // namespace cc |
| OLD | NEW |