| 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 4924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4935 EXPECT_EQ(result.width(), 192); | 4935 EXPECT_EQ(result.width(), 192); |
| 4936 EXPECT_EQ(result.height(), 192); | 4936 EXPECT_EQ(result.height(), 192); |
| 4937 result = layer->CalculateTileSize(gfx::Size(199, 199)); | 4937 result = layer->CalculateTileSize(gfx::Size(199, 199)); |
| 4938 EXPECT_EQ(result.width(), 200); | 4938 EXPECT_EQ(result.width(), 200); |
| 4939 EXPECT_EQ(result.height(), 200); | 4939 EXPECT_EQ(result.height(), 200); |
| 4940 | 4940 |
| 4941 // Gpu-rasterization uses 25% viewport-height tiles. | 4941 // Gpu-rasterization uses 25% viewport-height tiles. |
| 4942 // The +2's below are for border texels. | 4942 // The +2's below are for border texels. |
| 4943 host_impl_.SetUseGpuRasterization(true); | 4943 host_impl_.SetUseGpuRasterization(true); |
| 4944 host_impl_.SetViewportSize(gfx::Size(2000, 2000)); | 4944 host_impl_.SetViewportSize(gfx::Size(2000, 2000)); |
| 4945 |
| 4946 Region empty_invalidation; |
| 4947 const PictureLayerTilingSet* null_tiling_set = nullptr; |
| 4948 scoped_refptr<RasterSource> raster_source = |
| 4949 FakePicturePileImpl::CreateEmptyPile(gfx::Size(100, 100), |
| 4950 gfx::Size(0, 0)); |
| 4951 layer->UpdateRasterSource(raster_source, &empty_invalidation, null_tiling_set, |
| 4952 host_impl_.device_viewport_size()); |
| 4945 result = layer->CalculateTileSize(gfx::Size(10000, 10000)); | 4953 result = layer->CalculateTileSize(gfx::Size(10000, 10000)); |
| 4946 EXPECT_EQ(result.width(), 2000); | 4954 EXPECT_EQ(result.width(), 2000); |
| 4947 EXPECT_EQ(result.height(), 500 + 2); | 4955 EXPECT_EQ(result.height(), 500 + 2); |
| 4948 | 4956 |
| 4949 // Clamp and round-up, when smaller than viewport. | 4957 // Clamp and round-up, when smaller than viewport. |
| 4950 // Tile-height doubles to 50% when width shrinks to <= 50%. | 4958 // Tile-height doubles to 50% when width shrinks to <= 50%. |
| 4951 host_impl_.SetViewportSize(gfx::Size(1000, 1000)); | 4959 host_impl_.SetViewportSize(gfx::Size(1000, 1000)); |
| 4960 layer->UpdateRasterSource(raster_source, &empty_invalidation, null_tiling_set, |
| 4961 host_impl_.device_viewport_size()); |
| 4952 result = layer->CalculateTileSize(gfx::Size(447, 10000)); | 4962 result = layer->CalculateTileSize(gfx::Size(447, 10000)); |
| 4953 EXPECT_EQ(result.width(), 448); | 4963 EXPECT_EQ(result.width(), 448); |
| 4954 EXPECT_EQ(result.height(), 500 + 2); | 4964 EXPECT_EQ(result.height(), 500 + 2); |
| 4955 | 4965 |
| 4956 // Largest layer is 50% of viewport width (rounded up), and | 4966 // Largest layer is 50% of viewport width (rounded up), and |
| 4957 // 50% of viewport in height. | 4967 // 50% of viewport in height. |
| 4958 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4968 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
| 4959 EXPECT_EQ(result.width(), 448); | 4969 EXPECT_EQ(result.width(), 448); |
| 4960 EXPECT_EQ(result.height(), 448); | 4970 EXPECT_EQ(result.height(), 448); |
| 4961 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4971 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
| 4962 EXPECT_EQ(result.width(), 512); | 4972 EXPECT_EQ(result.width(), 512); |
| 4963 EXPECT_EQ(result.height(), 500 + 2); | 4973 EXPECT_EQ(result.height(), 500 + 2); |
| 4964 } | 4974 } |
| 4965 | 4975 |
| 4966 } // namespace | 4976 } // namespace |
| 4967 } // namespace cc | 4977 } // namespace cc |
| OLD | NEW |