| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 | 10 |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 | 685 |
| 686 int default_tile_width = 0; | 686 int default_tile_width = 0; |
| 687 int default_tile_height = 0; | 687 int default_tile_height = 0; |
| 688 if (layer_tree_impl()->use_gpu_rasterization()) { | 688 if (layer_tree_impl()->use_gpu_rasterization()) { |
| 689 // For GPU rasterization, we pick an ideal tile size using the viewport | 689 // For GPU rasterization, we pick an ideal tile size using the viewport |
| 690 // so we don't need any settings. The current approach uses 4 tiles | 690 // so we don't need any settings. The current approach uses 4 tiles |
| 691 // to cover the viewport vertically. | 691 // to cover the viewport vertically. |
| 692 int viewport_width = layer_tree_impl()->device_viewport_size().width(); | 692 int viewport_width = layer_tree_impl()->device_viewport_size().width(); |
| 693 int viewport_height = layer_tree_impl()->device_viewport_size().height(); | 693 int viewport_height = layer_tree_impl()->device_viewport_size().height(); |
| 694 default_tile_width = viewport_width; | 694 default_tile_width = viewport_width; |
| 695 default_tile_height = viewport_height / 4; | 695 // Also, double the height when the content width falls below 50%, and |
| 696 // pad by our border texels to make the tiles exactly match viewport. |
| 697 int divisor = (content_bounds.width() <= viewport_width / 2) ? 2 : 4; |
| 698 default_tile_height = RoundUp(viewport_height, divisor) / divisor; |
| 699 default_tile_height += 2 * PictureLayerTiling::kBorderTexels; |
| 696 default_tile_height = | 700 default_tile_height = |
| 697 std::max(default_tile_height, kMinHeightForGpuRasteredTile); | 701 std::max(default_tile_height, kMinHeightForGpuRasteredTile); |
| 698 | |
| 699 // Increase the tile-height proportionally when the content width | |
| 700 // drops below half the viewport width. | |
| 701 if (content_bounds.width() <= viewport_width / 2) | |
| 702 default_tile_height *= 2; | |
| 703 } else { | 702 } else { |
| 704 // For CPU rasterization we use tile-size settings. | 703 // For CPU rasterization we use tile-size settings. |
| 705 const LayerTreeSettings& settings = layer_tree_impl()->settings(); | 704 const LayerTreeSettings& settings = layer_tree_impl()->settings(); |
| 706 int max_untiled_content_width = settings.max_untiled_layer_size.width(); | 705 int max_untiled_content_width = settings.max_untiled_layer_size.width(); |
| 707 int max_untiled_content_height = settings.max_untiled_layer_size.height(); | 706 int max_untiled_content_height = settings.max_untiled_layer_size.height(); |
| 708 default_tile_width = settings.default_tile_size.width(); | 707 default_tile_width = settings.default_tile_size.width(); |
| 709 default_tile_height = settings.default_tile_size.height(); | 708 default_tile_height = settings.default_tile_size.height(); |
| 710 | 709 |
| 711 // If the content width is small, increase tile size vertically. | 710 // If the content width is small, increase tile size vertically. |
| 712 // If the content height is small, increase tile size horizontally. | 711 // If the content height is small, increase tile size horizontally. |
| (...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1812 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); | 1811 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); |
| 1813 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; | 1812 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; |
| 1814 return tiling_range.end - 1 - current_tiling_range_offset; | 1813 return tiling_range.end - 1 - current_tiling_range_offset; |
| 1815 } | 1814 } |
| 1816 } | 1815 } |
| 1817 NOTREACHED(); | 1816 NOTREACHED(); |
| 1818 return 0; | 1817 return 0; |
| 1819 } | 1818 } |
| 1820 | 1819 |
| 1821 } // namespace cc | 1820 } // namespace cc |
| OLD | NEW |