Chromium Code Reviews| Index: cc/layers/picture_layer_impl.cc |
| diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc |
| index 5012061c28551ab22bfccde0fce4d8b88c0867ce..029c731ed19241c724ee60c0edff73d844216d70 100644 |
| --- a/cc/layers/picture_layer_impl.cc |
| +++ b/cc/layers/picture_layer_impl.cc |
| @@ -692,13 +692,13 @@ std::unique_ptr<Tile> PictureLayerImpl::CreateTile( |
| const Tile::CreateInfo& info) { |
| int flags = 0; |
| - // We don't handle solid color masks, so we shouldn't bother analyzing those. |
| + // We don't handle solid color masks if mask tiling is disabled, we also don't |
| + // handle solid color single texture masks if the flag is enabled, so we |
| + // shouldn't bother analyzing those. |
| // Otherwise, always analyze to maximize memory savings. |
| - // TODO(sunxd): the condition should be (mask_type_ == |
| - // Layer::LayerMaskType::NOT_MASK |
| - // || (layer_tree_impl()->settings().enable_mask_tiling && mask_type == |
| - // Layer::LayerMaskType::MULTI_TEXTURE_MASK)). |
| - if (mask_type_ == Layer::LayerMaskType::NOT_MASK) |
| + if (mask_type_ == Layer::LayerMaskType::NOT_MASK || |
| + (layer_tree_impl()->settings().enable_mask_tiling && |
| + mask_type_ == Layer::LayerMaskType::MULTI_TEXTURE_MASK)) |
|
enne (OOO)
2017/02/10 22:24:34
Maybe setting the mask type should just ignore thi
trchen
2017/02/11 00:21:16
+1 to enne@
I think it is cleaner to change layer
sunxd
2017/02/13 18:13:42
Yeah I think it looks better, if mask tiling is di
|
| flags = Tile::USE_PICTURE_ANALYSIS; |
| if (contents_opaque()) |
| @@ -740,11 +740,9 @@ gfx::Size PictureLayerImpl::CalculateTileSize( |
| int max_texture_size = |
| layer_tree_impl()->resource_provider()->max_texture_size(); |
| - // TODO(sunxd): the condition should be mask_type_ == Layer::LayerMaskType:: |
| - // SINGLE_TEXTURE_MASK || (mask_type_ == |
| - // Layer::LayerMaskType::MULTI_TEXTURE_MASK && |
| - // !layer_tree_impl()->settings().enable_mask_tiling) |
| - if (mask_type_ != Layer::LayerMaskType::NOT_MASK) { |
| + if (mask_type_ == Layer::LayerMaskType::SINGLE_TEXTURE_MASK || |
| + (mask_type_ == Layer::LayerMaskType::MULTI_TEXTURE_MASK && |
| + !layer_tree_impl()->settings().enable_mask_tiling)) { |
| // Masks are not tiled, so if we can't cover the whole mask with one tile, |
| // we shouldn't have such a tiling at all. |
| DCHECK_LE(content_bounds.width(), max_texture_size); |
| @@ -1178,16 +1176,14 @@ float PictureLayerImpl::MinimumContentsScale() const { |
| } |
| float PictureLayerImpl::MaximumContentsScale() const { |
| - // Masks can not have tilings that would become larger than the |
| - // max_texture_size since they use a single tile for the entire |
| - // tiling. Other layers can have tilings such that dimension * scale |
| - // does not overflow. |
| - // TODO(sunxd): the condition should be: |
| - // mask_type_ == Layer::LayerMaskType::SINGLE_TEXTURE_MASK || (mask_type_ == |
| - // Layer::LayerMaskType::MULTI_TEXTURE_MASK && !layer_tree_impl()->settings(). |
| - // enable_mask_tiling) |
| + // When mask tiling is disabled or the mask is single textured, masks can not |
| + // have tilings that would become larger than the max_texture_size since they |
| + // use a single tile for the entire tiling. Other layers can have tilings such |
| + // that dimension * scale does not overflow. |
| float max_dimension = static_cast<float>( |
| - mask_type_ != Layer::LayerMaskType::NOT_MASK |
| + mask_type_ == Layer::LayerMaskType::SINGLE_TEXTURE_MASK || |
| + (mask_type_ == Layer::LayerMaskType::MULTI_TEXTURE_MASK && |
| + !layer_tree_impl()->settings().enable_mask_tiling) |
| ? layer_tree_impl()->resource_provider()->max_texture_size() |
| : std::numeric_limits<int>::max()); |
| float max_scale_width = max_dimension / bounds().width(); |