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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 divisor = 2; | 760 divisor = 2; |
761 if (content_bounds.width() <= viewport_width / 4) | 761 if (content_bounds.width() <= viewport_width / 4) |
762 divisor = 1; | 762 divisor = 1; |
763 default_tile_height = | 763 default_tile_height = |
764 MathUtil::UncheckedRoundUp(viewport_height, divisor) / divisor; | 764 MathUtil::UncheckedRoundUp(viewport_height, divisor) / divisor; |
765 | 765 |
766 // Grow default sizes to account for overlapping border texels. | 766 // Grow default sizes to account for overlapping border texels. |
767 default_tile_width += 2 * PictureLayerTiling::kBorderTexels; | 767 default_tile_width += 2 * PictureLayerTiling::kBorderTexels; |
768 default_tile_height += 2 * PictureLayerTiling::kBorderTexels; | 768 default_tile_height += 2 * PictureLayerTiling::kBorderTexels; |
769 | 769 |
| 770 // Round GPU default tile sizes to a multiple of kTileRoundUp. This |
| 771 // helps prevent rounding errors in our CA path. crbug.com/632274 |
| 772 default_tile_width = |
| 773 MathUtil::UncheckedRoundUp(default_tile_width, kTileRoundUp); |
| 774 default_tile_height = |
| 775 MathUtil::UncheckedRoundUp(default_tile_height, kTileRoundUp); |
| 776 |
770 default_tile_height = | 777 default_tile_height = |
771 std::max(default_tile_height, kMinHeightForGpuRasteredTile); | 778 std::max(default_tile_height, kMinHeightForGpuRasteredTile); |
772 } else { | 779 } else { |
773 // For CPU rasterization we use tile-size settings. | 780 // For CPU rasterization we use tile-size settings. |
774 const LayerTreeSettings& settings = layer_tree_impl()->settings(); | 781 const LayerTreeSettings& settings = layer_tree_impl()->settings(); |
775 int max_untiled_content_width = settings.max_untiled_layer_size.width(); | 782 int max_untiled_content_width = settings.max_untiled_layer_size.width(); |
776 int max_untiled_content_height = settings.max_untiled_layer_size.height(); | 783 int max_untiled_content_height = settings.max_untiled_layer_size.height(); |
777 default_tile_width = settings.default_tile_size.width(); | 784 default_tile_width = settings.default_tile_size.width(); |
778 default_tile_height = settings.default_tile_size.height(); | 785 default_tile_height = settings.default_tile_size.height(); |
779 | 786 |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1343 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
1337 return !layer_tree_impl()->IsRecycleTree(); | 1344 return !layer_tree_impl()->IsRecycleTree(); |
1338 } | 1345 } |
1339 | 1346 |
1340 bool PictureLayerImpl::HasValidTilePriorities() const { | 1347 bool PictureLayerImpl::HasValidTilePriorities() const { |
1341 return IsOnActiveOrPendingTree() && | 1348 return IsOnActiveOrPendingTree() && |
1342 is_drawn_render_surface_layer_list_member(); | 1349 is_drawn_render_surface_layer_list_member(); |
1343 } | 1350 } |
1344 | 1351 |
1345 } // namespace cc | 1352 } // namespace cc |
OLD | NEW |