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 4752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4763 // The +2's below are for border texels. | 4763 // The +2's below are for border texels. |
4764 host_impl()->SetHasGpuRasterizationTrigger(true); | 4764 host_impl()->SetHasGpuRasterizationTrigger(true); |
4765 EXPECT_EQ(host_impl()->gpu_rasterization_status(), | 4765 EXPECT_EQ(host_impl()->gpu_rasterization_status(), |
4766 GpuRasterizationStatus::ON); | 4766 GpuRasterizationStatus::ON); |
4767 host_impl()->SetViewportSize(gfx::Size(2000, 2000)); | 4767 host_impl()->SetViewportSize(gfx::Size(2000, 2000)); |
4768 | 4768 |
4769 layer->set_gpu_raster_max_texture_size(host_impl()->device_viewport_size()); | 4769 layer->set_gpu_raster_max_texture_size(host_impl()->device_viewport_size()); |
4770 result = layer->CalculateTileSize(gfx::Size(10000, 10000)); | 4770 result = layer->CalculateTileSize(gfx::Size(10000, 10000)); |
4771 EXPECT_EQ(result.width(), | 4771 EXPECT_EQ(result.width(), |
4772 MathUtil::UncheckedRoundUp( | 4772 MathUtil::UncheckedRoundUp( |
4773 2000 + 2 * PictureLayerTiling::kBorderTexels, 64)); | 4773 2000 + 2 * PictureLayerTiling::kBorderTexels, 4)); |
4774 EXPECT_EQ(result.height(), 512); // 500 + 2, 64-byte aligned. | 4774 EXPECT_EQ(result.height(), 504); // 500 + 2, 4-byte aligned. |
4775 | 4775 |
4776 // Clamp and round-up, when smaller than viewport. | 4776 // Clamp and round-up, when smaller than viewport. |
4777 // Tile-height doubles to 50% when width shrinks to <= 50%. | 4777 // Tile-height doubles to 50% when width shrinks to <= 50%. |
4778 host_impl()->SetViewportSize(gfx::Size(1000, 1000)); | 4778 host_impl()->SetViewportSize(gfx::Size(1000, 1000)); |
4779 layer->set_gpu_raster_max_texture_size(host_impl()->device_viewport_size()); | 4779 layer->set_gpu_raster_max_texture_size(host_impl()->device_viewport_size()); |
4780 result = layer->CalculateTileSize(gfx::Size(447, 10000)); | 4780 result = layer->CalculateTileSize(gfx::Size(447, 10000)); |
4781 EXPECT_EQ(result.width(), 448); | 4781 EXPECT_EQ(result.width(), 448); |
4782 EXPECT_EQ(result.height(), 512); // 500 + 2, 64-byte aliged. | 4782 EXPECT_EQ(result.height(), 504); // 500 + 2, 4-byte aliged. |
4783 | 4783 |
4784 // Largest layer is 50% of viewport width (rounded up), and | 4784 // Largest layer is 50% of viewport width (rounded up), and |
4785 // 50% of viewport in height. | 4785 // 50% of viewport in height. |
4786 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4786 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
4787 EXPECT_EQ(result.width(), 448); | 4787 EXPECT_EQ(result.width(), 448); |
4788 EXPECT_EQ(result.height(), 448); | 4788 EXPECT_EQ(result.height(), 448); |
4789 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4789 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
4790 EXPECT_EQ(result.width(), 512); | 4790 EXPECT_EQ(result.width(), 512); |
4791 EXPECT_EQ(result.height(), 512); // 500 + 2, 64-byte aligned. | 4791 EXPECT_EQ(result.height(), 504); // 500 + 2, 4-byte aligned. |
4792 } | 4792 } |
4793 | 4793 |
4794 TEST_F(NoLowResPictureLayerImplTest, LowResWasHighResCollision) { | 4794 TEST_F(NoLowResPictureLayerImplTest, LowResWasHighResCollision) { |
4795 gfx::Size layer_bounds(1300, 1900); | 4795 gfx::Size layer_bounds(1300, 1900); |
4796 | 4796 |
4797 float low_res_factor = host_impl()->settings().low_res_contents_scale_factor; | 4797 float low_res_factor = host_impl()->settings().low_res_contents_scale_factor; |
4798 SetupDefaultTrees(layer_bounds); | 4798 SetupDefaultTrees(layer_bounds); |
4799 ResetTilingsAndRasterScales(); | 4799 ResetTilingsAndRasterScales(); |
4800 | 4800 |
4801 float page_scale = 2.f; | 4801 float page_scale = 2.f; |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5016 EXPECT_FLOAT_EQ(expected_contents_scale, | 5016 EXPECT_FLOAT_EQ(expected_contents_scale, |
5017 pending_layer_ptr->picture_layer_tiling_set() | 5017 pending_layer_ptr->picture_layer_tiling_set() |
5018 ->FindTilingWithResolution(HIGH_RESOLUTION) | 5018 ->FindTilingWithResolution(HIGH_RESOLUTION) |
5019 ->contents_scale()) | 5019 ->contents_scale()) |
5020 << "ideal_contents_scale: " << ideal_contents_scale; | 5020 << "ideal_contents_scale: " << ideal_contents_scale; |
5021 } | 5021 } |
5022 } | 5022 } |
5023 | 5023 |
5024 } // namespace | 5024 } // namespace |
5025 } // namespace cc | 5025 } // namespace cc |
OLD | NEW |