Index: cc/layers/picture_layer_impl.cc |
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc |
index 37c83289700ab9fef4cd1fb356d0f9c354d29b0f..cb4862c34ff3134c7e529c61da51e819892ec2ed 100644 |
--- a/cc/layers/picture_layer_impl.cc |
+++ b/cc/layers/picture_layer_impl.cc |
@@ -675,17 +675,23 @@ gfx::Size PictureLayerImpl::CalculateTileSize( |
} |
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 |
- // default-tile-size. |
- default_tile_size = |
- gfx::Size(layer_tree_impl()->device_viewport_size().width(), |
- layer_tree_impl()->device_viewport_size().height() / 4); |
- } |
- default_tile_size.SetToMin(gfx::Size(max_texture_size, max_texture_size)); |
- |
gfx::Size max_untiled_content_size = |
layer_tree_impl()->settings().max_untiled_layer_size; |
+ |
+ // For GPU rasterization, we pick an ideal tile size using the viewport, |
+ // so we don't need the above settings. |
+ bool use_gpu = layer_tree_impl()->use_gpu_rasterization(); |
+ if (use_gpu) { |
+ int width = layer_tree_impl()->device_viewport_size().width(); |
+ int height = layer_tree_impl()->device_viewport_size().height() / 4; |
+ height = std::max(height, 128); |
vmpstr
2014/10/08 23:30:28
nit: Consider making this a constant.
epennerAtGoogle
2014/10/09 00:29:43
Done.
|
+ default_tile_size = gfx::Size(width, height); |
+ // Since the width is already expanded to viewport width, we use |
+ // double the height as our max untiled size. |
+ max_untiled_content_size = gfx::Size(height * 2, height * 2); |
+ } |
+ |
+ default_tile_size.SetToMin(gfx::Size(max_texture_size, max_texture_size)); |
max_untiled_content_size.SetToMin( |
gfx::Size(max_texture_size, max_texture_size)); |
@@ -694,8 +700,8 @@ gfx::Size PictureLayerImpl::CalculateTileSize( |
content_bounds.height() > max_untiled_content_size.height(); |
bool any_dimension_one_tile = |
- content_bounds.width() <= default_tile_size.width() || |
- content_bounds.height() <= default_tile_size.height(); |
+ !use_gpu && (content_bounds.width() <= default_tile_size.width() || |
vmpstr
2014/10/08 23:30:28
Can you make a comment here or something like that
epennerAtGoogle
2014/10/09 00:29:43
Done.
While adding the comment, I realized this c
|
+ content_bounds.height() <= default_tile_size.height()); |
// If long and skinny, tile at the max untiled content size, and clamp |
// the smaller dimension to the content size, e.g. 1000x12 layer with |