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 layer->set_gpu_raster_max_texture_size(host_impl_.device_viewport_size()); |
4945 result = layer->CalculateTileSize(gfx::Size(10000, 10000)); | 4947 result = layer->CalculateTileSize(gfx::Size(10000, 10000)); |
4946 EXPECT_EQ(result.width(), 2000); | 4948 EXPECT_EQ(result.width(), 2000); |
4947 EXPECT_EQ(result.height(), 500 + 2); | 4949 EXPECT_EQ(result.height(), 500 + 2); |
4948 | 4950 |
4949 // Clamp and round-up, when smaller than viewport. | 4951 // Clamp and round-up, when smaller than viewport. |
4950 // Tile-height doubles to 50% when width shrinks to <= 50%. | 4952 // Tile-height doubles to 50% when width shrinks to <= 50%. |
4951 host_impl_.SetViewportSize(gfx::Size(1000, 1000)); | 4953 host_impl_.SetViewportSize(gfx::Size(1000, 1000)); |
| 4954 layer->set_gpu_raster_max_texture_size(host_impl_.device_viewport_size()); |
4952 result = layer->CalculateTileSize(gfx::Size(447, 10000)); | 4955 result = layer->CalculateTileSize(gfx::Size(447, 10000)); |
4953 EXPECT_EQ(result.width(), 448); | 4956 EXPECT_EQ(result.width(), 448); |
4954 EXPECT_EQ(result.height(), 500 + 2); | 4957 EXPECT_EQ(result.height(), 500 + 2); |
4955 | 4958 |
4956 // Largest layer is 50% of viewport width (rounded up), and | 4959 // Largest layer is 50% of viewport width (rounded up), and |
4957 // 50% of viewport in height. | 4960 // 50% of viewport in height. |
4958 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4961 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
4959 EXPECT_EQ(result.width(), 448); | 4962 EXPECT_EQ(result.width(), 448); |
4960 EXPECT_EQ(result.height(), 448); | 4963 EXPECT_EQ(result.height(), 448); |
4961 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4964 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
4962 EXPECT_EQ(result.width(), 512); | 4965 EXPECT_EQ(result.width(), 512); |
4963 EXPECT_EQ(result.height(), 500 + 2); | 4966 EXPECT_EQ(result.height(), 500 + 2); |
4964 } | 4967 } |
4965 | 4968 |
4966 } // namespace | 4969 } // namespace |
4967 } // namespace cc | 4970 } // namespace cc |
OLD | NEW |