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 <cmath> | 8 #include <cmath> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 760 tile_width = std::min(tile_width, content_bounds.width()); | 760 tile_width = std::min(tile_width, content_bounds.width()); |
| 761 tile_width = MathUtil::UncheckedRoundUp(tile_width, kTileRoundUp); | 761 tile_width = MathUtil::UncheckedRoundUp(tile_width, kTileRoundUp); |
| 762 tile_width = std::min(tile_width, default_tile_width); | 762 tile_width = std::min(tile_width, default_tile_width); |
| 763 } | 763 } |
| 764 if (content_bounds.height() < default_tile_height) { | 764 if (content_bounds.height() < default_tile_height) { |
| 765 tile_height = std::min(tile_height, content_bounds.height()); | 765 tile_height = std::min(tile_height, content_bounds.height()); |
| 766 tile_height = MathUtil::UncheckedRoundUp(tile_height, kTileRoundUp); | 766 tile_height = MathUtil::UncheckedRoundUp(tile_height, kTileRoundUp); |
| 767 tile_height = std::min(tile_height, default_tile_height); | 767 tile_height = std::min(tile_height, default_tile_height); |
| 768 } | 768 } |
| 769 | 769 |
| 770 // Ensure that tiles are an even multiple of 4 in size. | |
|
reveman
2015/12/01 17:27:24
Unconditionally use MathUtil::UncheckedRoundUp(til
christiank
2015/12/02 16:18:14
Done.
| |
| 771 if (tile_width % 4 != 0 || tile_height % 4 != 0) { | |
| 772 // Round the size up to the nearest multiple of four. | |
| 773 tile_width = 4 * std::ceil(static_cast<float>(tile_width) / 4); | |
| 774 tile_height = 4 * std::ceil(static_cast<float>(tile_height) / 4); | |
| 775 } | |
| 776 | |
| 770 // Under no circumstance should we be larger than the max texture size. | 777 // Under no circumstance should we be larger than the max texture size. |
| 771 tile_width = std::min(tile_width, max_texture_size); | 778 tile_width = std::min(tile_width, max_texture_size); |
| 772 tile_height = std::min(tile_height, max_texture_size); | 779 tile_height = std::min(tile_height, max_texture_size); |
| 773 return gfx::Size(tile_width, tile_height); | 780 return gfx::Size(tile_width, tile_height); |
| 774 } | 781 } |
| 775 | 782 |
| 776 void PictureLayerImpl::GetContentsResourceId(ResourceId* resource_id, | 783 void PictureLayerImpl::GetContentsResourceId(ResourceId* resource_id, |
| 777 gfx::Size* resource_size) const { | 784 gfx::Size* resource_size) const { |
| 778 // The bounds and the pile size may differ if the pile wasn't updated (ie. | 785 // The bounds and the pile size may differ if the pile wasn't updated (ie. |
| 779 // PictureLayer::Update didn't happen). In that case the pile will be empty. | 786 // PictureLayer::Update didn't happen). In that case the pile will be empty. |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1240 | 1247 |
| 1241 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1248 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
| 1242 return !layer_tree_impl()->IsRecycleTree(); | 1249 return !layer_tree_impl()->IsRecycleTree(); |
| 1243 } | 1250 } |
| 1244 | 1251 |
| 1245 bool PictureLayerImpl::HasValidTilePriorities() const { | 1252 bool PictureLayerImpl::HasValidTilePriorities() const { |
| 1246 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); | 1253 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); |
| 1247 } | 1254 } |
| 1248 | 1255 |
| 1249 } // namespace cc | 1256 } // namespace cc |
| OLD | NEW |