Index: cc/layers/picture_layer_impl.cc |
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc |
index 0849c516bab58e63b183c957eb877e748f85187a..0a6e8a5e0320f6bb89e0e068ff89239b3dbff3e4 100644 |
--- a/cc/layers/picture_layer_impl.cc |
+++ b/cc/layers/picture_layer_impl.cc |
@@ -48,6 +48,10 @@ const int kMinHeightForGpuRasteredTile = 256; |
// of using the same tile size. |
const int kTileRoundUp = 64; |
+// For performance reasons and to support compressed tile textures, tile |
+// width and height should be an even multiple of 4 in size. |
+const int kTileMinimalAlignment = 4; |
+ |
} // namespace |
namespace cc { |
@@ -767,6 +771,14 @@ gfx::Size PictureLayerImpl::CalculateTileSize( |
tile_height = std::min(tile_height, default_tile_height); |
} |
+ // Ensure that tile width and height are properly aligned. |
+ if (tile_width % kTileMinimalAlignment != 0 || |
+ tile_height % kTileMinimalAlignment != 0) { |
reveman
2015/12/02 18:27:18
nit: remove these checks and execute UncheckedRoun
christiank
2015/12/03 12:57:59
Done.
|
+ tile_width = MathUtil::UncheckedRoundUp(tile_width, kTileMinimalAlignment); |
+ tile_height = |
+ MathUtil::UncheckedRoundUp(tile_height, kTileMinimalAlignment); |
+ } |
+ |
// Under no circumstance should we be larger than the max texture size. |
tile_width = std::min(tile_width, max_texture_size); |
tile_height = std::min(tile_height, max_texture_size); |