| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 <limits> | 5 #include <limits> |
| 6 #include <set> | 6 #include <set> |
| 7 | 7 |
| 8 #include "cc/base/math_util.h" | 8 #include "cc/base/math_util.h" |
| 9 #include "cc/resources/picture_layer_tiling.h" | 9 #include "cc/resources/picture_layer_tiling.h" |
| 10 #include "cc/resources/picture_layer_tiling_set.h" | 10 #include "cc/resources/picture_layer_tiling_set.h" |
| (...skipping 1933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1944 EXPECT_FALSE(active_tiling->TileAt(0, 0)); | 1944 EXPECT_FALSE(active_tiling->TileAt(0, 0)); |
| 1945 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); | 1945 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); |
| 1946 } | 1946 } |
| 1947 | 1947 |
| 1948 TEST_F(PictureLayerTilingIteratorTest, ResizeTilesAndUpdateToCurrent) { | 1948 TEST_F(PictureLayerTilingIteratorTest, ResizeTilesAndUpdateToCurrent) { |
| 1949 // The tiling has four rows and three columns. | 1949 // The tiling has four rows and three columns. |
| 1950 Initialize(gfx::Size(150, 100), 1.f, gfx::Size(250, 150)); | 1950 Initialize(gfx::Size(150, 100), 1.f, gfx::Size(250, 150)); |
| 1951 tiling_->CreateAllTilesForTesting(); | 1951 tiling_->CreateAllTilesForTesting(); |
| 1952 EXPECT_EQ(150, tiling_->TilingDataForTesting().max_texture_size().width()); | 1952 EXPECT_EQ(150, tiling_->TilingDataForTesting().max_texture_size().width()); |
| 1953 EXPECT_EQ(100, tiling_->TilingDataForTesting().max_texture_size().height()); | 1953 EXPECT_EQ(100, tiling_->TilingDataForTesting().max_texture_size().height()); |
| 1954 EXPECT_EQ(4u, tiling_->AllTilesForTesting().size()); | 1954 EXPECT_EQ(4u, tiling_->AllRefTilesForTesting().size()); |
| 1955 | 1955 |
| 1956 client_.SetTileSize(gfx::Size(250, 200)); | 1956 client_.SetTileSize(gfx::Size(250, 200)); |
| 1957 | 1957 |
| 1958 // Tile size in the tiling should still be 150x100. | 1958 // Tile size in the tiling should still be 150x100. |
| 1959 EXPECT_EQ(150, tiling_->TilingDataForTesting().max_texture_size().width()); | 1959 EXPECT_EQ(150, tiling_->TilingDataForTesting().max_texture_size().width()); |
| 1960 EXPECT_EQ(100, tiling_->TilingDataForTesting().max_texture_size().height()); | 1960 EXPECT_EQ(100, tiling_->TilingDataForTesting().max_texture_size().height()); |
| 1961 | 1961 |
| 1962 // The layer's size isn't changed, but the tile size was. | 1962 // The layer's size isn't changed, but the tile size was. |
| 1963 scoped_refptr<FakePicturePileImpl> pile = | 1963 scoped_refptr<FakePicturePileImpl> pile = |
| 1964 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize( | 1964 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize( |
| 1965 gfx::Size(250, 150)); | 1965 gfx::Size(250, 150)); |
| 1966 tiling_->SetRasterSourceAndResize(pile); | 1966 tiling_->SetRasterSourceAndResize(pile); |
| 1967 | 1967 |
| 1968 // Tile size in the tiling should be resized to 250x200. | 1968 // Tile size in the tiling should be resized to 250x200. |
| 1969 EXPECT_EQ(250, tiling_->TilingDataForTesting().max_texture_size().width()); | 1969 EXPECT_EQ(250, tiling_->TilingDataForTesting().max_texture_size().width()); |
| 1970 EXPECT_EQ(200, tiling_->TilingDataForTesting().max_texture_size().height()); | 1970 EXPECT_EQ(200, tiling_->TilingDataForTesting().max_texture_size().height()); |
| 1971 EXPECT_EQ(0u, tiling_->AllTilesForTesting().size()); | 1971 EXPECT_EQ(0u, tiling_->AllRefTilesForTesting().size()); |
| 1972 } | 1972 } |
| 1973 | 1973 |
| 1974 } // namespace | 1974 } // namespace |
| 1975 } // namespace cc | 1975 } // namespace cc |
| OLD | NEW |