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 4390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4401 result = layer->CalculateTileSize(gfx::Size(42, 42)); | 4401 result = layer->CalculateTileSize(gfx::Size(42, 42)); |
4402 EXPECT_EQ(result.width(), 64); | 4402 EXPECT_EQ(result.width(), 64); |
4403 EXPECT_EQ(result.height(), 64); | 4403 EXPECT_EQ(result.height(), 64); |
4404 result = layer->CalculateTileSize(gfx::Size(184, 184)); | 4404 result = layer->CalculateTileSize(gfx::Size(184, 184)); |
4405 EXPECT_EQ(result.width(), 192); | 4405 EXPECT_EQ(result.width(), 192); |
4406 EXPECT_EQ(result.height(), 192); | 4406 EXPECT_EQ(result.height(), 192); |
4407 result = layer->CalculateTileSize(gfx::Size(199, 199)); | 4407 result = layer->CalculateTileSize(gfx::Size(199, 199)); |
4408 EXPECT_EQ(result.width(), 200); | 4408 EXPECT_EQ(result.width(), 200); |
4409 EXPECT_EQ(result.height(), 200); | 4409 EXPECT_EQ(result.height(), 200); |
4410 | 4410 |
4411 // Gpu-rasterization uses 25% viewport-height tiles. | |
4412 // The +2's below are for border texels. | |
4411 host_impl_.SetUseGpuRasterization(true); | 4413 host_impl_.SetUseGpuRasterization(true); |
4412 | |
4413 // Gpu-rasterization uses 25% viewport-height tiles. | |
4414 result = layer->CalculateTileSize(gfx::Size(10000, 10000)); | 4414 result = layer->CalculateTileSize(gfx::Size(10000, 10000)); |
4415 EXPECT_EQ(result.width(), 1000); | 4415 EXPECT_EQ(result.width(), 1000); |
4416 EXPECT_EQ(result.height(), 250); | 4416 EXPECT_EQ(result.height(), 250 + 2); |
4417 | 4417 |
4418 // Clamp and round-up, when smaller than viewport. | 4418 // Clamp and round-up, when smaller than viewport. |
4419 result = layer->CalculateTileSize(gfx::Size(831, 10000)); | 4419 result = layer->CalculateTileSize(gfx::Size(831, 10000)); |
4420 EXPECT_EQ(result.width(), 832); | 4420 EXPECT_EQ(result.width(), 832); |
4421 EXPECT_EQ(result.height(), 250); | 4421 EXPECT_EQ(result.height(), 250 + 2); |
4422 | 4422 |
4423 // Tile-height doubles to 50% when width shrinks to <= 50%. | 4423 // Tile-height doubles to 50% when width shrinks to <= 50%. |
enne (OOO)
2014/10/10 00:06:05
For what it's worth, I think this "viewport / 4" m
| |
4424 result = layer->CalculateTileSize(gfx::Size(447, 10000)); | 4424 result = layer->CalculateTileSize(gfx::Size(447, 10000)); |
4425 EXPECT_EQ(result.width(), 448); | 4425 EXPECT_EQ(result.width(), 448); |
4426 EXPECT_EQ(result.height(), 500); | 4426 EXPECT_EQ(result.height(), 500 + 2); |
4427 | 4427 |
4428 // Largest layer is 50% of viewport width (rounded up), and | 4428 // Largest layer is 50% of viewport width (rounded up), and |
4429 // 50% of viewport in height. | 4429 // 50% of viewport in height. |
4430 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4430 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
4431 EXPECT_EQ(result.width(), 448); | 4431 EXPECT_EQ(result.width(), 448); |
4432 EXPECT_EQ(result.height(), 448); | 4432 EXPECT_EQ(result.height(), 448); |
4433 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4433 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
4434 EXPECT_EQ(result.width(), 512); | 4434 EXPECT_EQ(result.width(), 512); |
4435 EXPECT_EQ(result.height(), 500); | 4435 EXPECT_EQ(result.height(), 500 + 2); |
4436 } | 4436 } |
4437 | 4437 |
4438 } // namespace | 4438 } // namespace |
4439 } // namespace cc | 4439 } // namespace cc |
OLD | NEW |