| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 4736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4747 // The +2's below are for border texels. | 4747 // The +2's below are for border texels. |
| 4748 host_impl()->SetHasGpuRasterizationTrigger(true); | 4748 host_impl()->SetHasGpuRasterizationTrigger(true); |
| 4749 EXPECT_EQ(host_impl()->gpu_rasterization_status(), | 4749 EXPECT_EQ(host_impl()->gpu_rasterization_status(), |
| 4750 GpuRasterizationStatus::ON); | 4750 GpuRasterizationStatus::ON); |
| 4751 host_impl()->SetViewportSize(gfx::Size(2000, 2000)); | 4751 host_impl()->SetViewportSize(gfx::Size(2000, 2000)); |
| 4752 | 4752 |
| 4753 layer->set_gpu_raster_max_texture_size(host_impl()->device_viewport_size()); | 4753 layer->set_gpu_raster_max_texture_size(host_impl()->device_viewport_size()); |
| 4754 result = layer->CalculateTileSize(gfx::Size(10000, 10000)); | 4754 result = layer->CalculateTileSize(gfx::Size(10000, 10000)); |
| 4755 EXPECT_EQ(result.width(), | 4755 EXPECT_EQ(result.width(), |
| 4756 MathUtil::UncheckedRoundUp( | 4756 MathUtil::UncheckedRoundUp( |
| 4757 2000 + 2 * PictureLayerTiling::kBorderTexels, 4)); | 4757 2000 + 2 * PictureLayerTiling::kBorderTexels, 32)); |
| 4758 EXPECT_EQ(result.height(), 504); // 500 + 2, 4-byte aligned. | 4758 EXPECT_EQ(result.height(), 512); // 500 + 2, 32-byte aligned. |
| 4759 | 4759 |
| 4760 // Clamp and round-up, when smaller than viewport. | 4760 // Clamp and round-up, when smaller than viewport. |
| 4761 // Tile-height doubles to 50% when width shrinks to <= 50%. | 4761 // Tile-height doubles to 50% when width shrinks to <= 50%. |
| 4762 host_impl()->SetViewportSize(gfx::Size(1000, 1000)); | 4762 host_impl()->SetViewportSize(gfx::Size(1000, 1000)); |
| 4763 layer->set_gpu_raster_max_texture_size(host_impl()->device_viewport_size()); | 4763 layer->set_gpu_raster_max_texture_size(host_impl()->device_viewport_size()); |
| 4764 result = layer->CalculateTileSize(gfx::Size(447, 10000)); | 4764 result = layer->CalculateTileSize(gfx::Size(447, 10000)); |
| 4765 EXPECT_EQ(result.width(), 448); | 4765 EXPECT_EQ(result.width(), 448); |
| 4766 EXPECT_EQ(result.height(), 504); // 500 + 2, 4-byte aliged. | 4766 EXPECT_EQ(result.height(), 512); // 500 + 2, 32-byte aliged. |
| 4767 | 4767 |
| 4768 // Largest layer is 50% of viewport width (rounded up), and | 4768 // Largest layer is 50% of viewport width (rounded up), and |
| 4769 // 50% of viewport in height. | 4769 // 50% of viewport in height. |
| 4770 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4770 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
| 4771 EXPECT_EQ(result.width(), 448); | 4771 EXPECT_EQ(result.width(), 448); |
| 4772 EXPECT_EQ(result.height(), 448); | 4772 EXPECT_EQ(result.height(), 448); |
| 4773 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4773 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
| 4774 EXPECT_EQ(result.width(), 512); | 4774 EXPECT_EQ(result.width(), 512); |
| 4775 EXPECT_EQ(result.height(), 504); // 500 + 2, 4-byte aligned. | 4775 EXPECT_EQ(result.height(), 512); // 500 + 2, 32-byte aligned. |
| 4776 } | 4776 } |
| 4777 | 4777 |
| 4778 TEST_F(NoLowResPictureLayerImplTest, LowResWasHighResCollision) { | 4778 TEST_F(NoLowResPictureLayerImplTest, LowResWasHighResCollision) { |
| 4779 gfx::Size layer_bounds(1300, 1900); | 4779 gfx::Size layer_bounds(1300, 1900); |
| 4780 | 4780 |
| 4781 float low_res_factor = host_impl()->settings().low_res_contents_scale_factor; | 4781 float low_res_factor = host_impl()->settings().low_res_contents_scale_factor; |
| 4782 SetupDefaultTrees(layer_bounds); | 4782 SetupDefaultTrees(layer_bounds); |
| 4783 ResetTilingsAndRasterScales(); | 4783 ResetTilingsAndRasterScales(); |
| 4784 | 4784 |
| 4785 float page_scale = 2.f; | 4785 float page_scale = 2.f; |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5000 EXPECT_FLOAT_EQ(expected_contents_scale, | 5000 EXPECT_FLOAT_EQ(expected_contents_scale, |
| 5001 pending_layer_ptr->picture_layer_tiling_set() | 5001 pending_layer_ptr->picture_layer_tiling_set() |
| 5002 ->FindTilingWithResolution(HIGH_RESOLUTION) | 5002 ->FindTilingWithResolution(HIGH_RESOLUTION) |
| 5003 ->contents_scale()) | 5003 ->contents_scale()) |
| 5004 << "ideal_contents_scale: " << ideal_contents_scale; | 5004 << "ideal_contents_scale: " << ideal_contents_scale; |
| 5005 } | 5005 } |
| 5006 } | 5006 } |
| 5007 | 5007 |
| 5008 } // namespace | 5008 } // namespace |
| 5009 } // namespace cc | 5009 } // namespace cc |
| OLD | NEW |