Chromium Code Reviews| 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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 668 if (pile_->is_mask()) { | 668 if (pile_->is_mask()) { |
| 669 // Masks are not tiled, so if we can't cover the whole mask with one tile, | 669 // Masks are not tiled, so if we can't cover the whole mask with one tile, |
| 670 // don't make any tiles at all. Returning an empty size signals this. | 670 // don't make any tiles at all. Returning an empty size signals this. |
| 671 if (content_bounds.width() > max_texture_size || | 671 if (content_bounds.width() > max_texture_size || |
| 672 content_bounds.height() > max_texture_size) | 672 content_bounds.height() > max_texture_size) |
| 673 return gfx::Size(); | 673 return gfx::Size(); |
| 674 return content_bounds; | 674 return content_bounds; |
| 675 } | 675 } |
| 676 | 676 |
| 677 gfx::Size default_tile_size = layer_tree_impl()->settings().default_tile_size; | 677 gfx::Size default_tile_size = layer_tree_impl()->settings().default_tile_size; |
| 678 if (layer_tree_impl()->use_gpu_rasterization()) { | |
| 679 // TODO(ernstm) crbug.com/365877: We need a unified way to override the | |
| 680 // default-tile-size. | |
| 681 default_tile_size = | |
| 682 gfx::Size(layer_tree_impl()->device_viewport_size().width(), | |
| 683 layer_tree_impl()->device_viewport_size().height() / 4); | |
| 684 } | |
| 685 default_tile_size.SetToMin(gfx::Size(max_texture_size, max_texture_size)); | |
| 686 | |
| 687 gfx::Size max_untiled_content_size = | 678 gfx::Size max_untiled_content_size = |
| 688 layer_tree_impl()->settings().max_untiled_layer_size; | 679 layer_tree_impl()->settings().max_untiled_layer_size; |
| 680 | |
| 681 // For GPU rasterization, we pick an ideal tile size using the viewport, | |
| 682 // so we don't need the above settings. | |
| 683 if (layer_tree_impl()->use_gpu_rasterization()) { | |
| 684 int width = layer_tree_impl()->device_viewport_size().width(); | |
| 685 int height = layer_tree_impl()->device_viewport_size().height() / 4; | |
|
vmpstr
2014/10/07 17:49:47
Can you do something like std::min(1, layer_tree_i
ernstm
2014/10/07 18:17:31
How about rounding up: ((...)+3)/4.
| |
| 686 default_tile_size = gfx::Size(width, height); | |
| 687 // Since the width is already expanded to viewport width, we use | |
| 688 // double the height as our max untiled size. | |
| 689 max_untiled_content_size = gfx::Size(height, height); | |
|
ernstm
2014/10/07 18:17:31
This sets the max_untiled_content_size to height^2
| |
| 690 } | |
| 691 | |
| 692 default_tile_size.SetToMin(gfx::Size(max_texture_size, max_texture_size)); | |
| 689 max_untiled_content_size.SetToMin( | 693 max_untiled_content_size.SetToMin( |
| 690 gfx::Size(max_texture_size, max_texture_size)); | 694 gfx::Size(max_texture_size, max_texture_size)); |
| 691 | 695 |
| 692 bool any_dimension_too_large = | 696 bool any_dimension_too_large = |
| 693 content_bounds.width() > max_untiled_content_size.width() || | 697 content_bounds.width() > max_untiled_content_size.width() || |
| 694 content_bounds.height() > max_untiled_content_size.height(); | 698 content_bounds.height() > max_untiled_content_size.height(); |
| 695 | 699 |
| 696 bool any_dimension_one_tile = | 700 bool any_dimension_one_tile = |
| 697 content_bounds.width() <= default_tile_size.width() || | 701 content_bounds.width() <= default_tile_size.width() || |
| 698 content_bounds.height() <= default_tile_size.height(); | 702 content_bounds.height() <= default_tile_size.height(); |
| (...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1787 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); | 1791 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); |
| 1788 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; | 1792 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; |
| 1789 return tiling_range.end - 1 - current_tiling_range_offset; | 1793 return tiling_range.end - 1 - current_tiling_range_offset; |
| 1790 } | 1794 } |
| 1791 } | 1795 } |
| 1792 NOTREACHED(); | 1796 NOTREACHED(); |
| 1793 return 0; | 1797 return 0; |
| 1794 } | 1798 } |
| 1795 | 1799 |
| 1796 } // namespace cc | 1800 } // namespace cc |
| OLD | NEW |