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 763f05e1e33ccaac7a3351bf28883ace51575183..32b629dbe45c3f81d720bfad9091227707026ade 100644 |
| --- a/cc/layers/picture_layer_impl.cc |
| +++ b/cc/layers/picture_layer_impl.cc |
| @@ -645,16 +645,16 @@ int PictureLayerImpl::GetSkewportExtrapolationLimitInContentPixels() const { |
| gfx::Size PictureLayerImpl::CalculateTileSize( |
| const gfx::Size& content_bounds) const { |
| - if (is_mask_) { |
| - int max_size = layer_tree_impl()->MaxTextureSize(); |
| - return gfx::Size( |
| - std::min(max_size, content_bounds.width()), |
| - std::min(max_size, content_bounds.height())); |
| - } |
| - |
| int max_texture_size = |
| layer_tree_impl()->resource_provider()->max_texture_size(); |
|
vmpstr
2014/09/05 17:44:57
Is this max_texture_size the same as layer_tree_im
danakj
2014/09/05 22:09:52
Ya. RendererCaps is set based on the value from Re
|
| + if (is_mask_) { |
| + if (content_bounds.width() > max_texture_size || |
|
vmpstr
2014/09/05 17:44:57
Can you please drop a comment here saying that "bl
danakj
2014/09/05 22:09:51
Done.
|
| + content_bounds.height() > max_texture_size) |
| + return gfx::Size(); |
| + return content_bounds; |
| + } |
| + |
| gfx::Size default_tile_size = layer_tree_impl()->settings().default_tile_size; |
| if (layer_tree_impl()->use_gpu_rasterization()) { |
| // TODO(ernstm) crbug.com/365877: We need a unified way to override the |
| @@ -775,8 +775,9 @@ ResourceProvider::ResourceId PictureLayerImpl::ContentsResourceId() const { |
| return 0; |
| // Masks only supported if they fit on exactly one tile. |
| - if (iter.geometry_rect() != content_rect) |
| - return 0; |
| + DCHECK(iter.geometry_rect() == content_rect) |
| + << "iter rect " << iter.geometry_rect().ToString() << " content rect " |
| + << content_rect.ToString(); |
| const ManagedTileState::TileVersion& tile_version = |
| iter->GetTileVersionForDrawing(); |
| @@ -1192,13 +1193,14 @@ void PictureLayerImpl::RecalculateRasterScales() { |
| } |
| } |
| - // If this layer would only create one tile at this content scale, |
| + // If this layer would create zero or one tiles at this content scale, |
| // don't create a low res tiling. |
| gfx::Size content_bounds = |
| gfx::ToCeiledSize(gfx::ScaleSize(bounds(), raster_contents_scale_)); |
| gfx::Size tile_size = CalculateTileSize(content_bounds); |
| - if (tile_size.width() >= content_bounds.width() && |
| - tile_size.height() >= content_bounds.height()) { |
| + bool tile_covers_bounds = tile_size.width() >= content_bounds.width() && |
| + tile_size.height() >= content_bounds.height(); |
| + if (tile_size.IsEmpty() || tile_covers_bounds) { |
| low_res_raster_contents_scale_ = raster_contents_scale_; |
| return; |
| } |