Index: cc/base/tiling_data.cc |
diff --git a/cc/base/tiling_data.cc b/cc/base/tiling_data.cc |
index af581ff19ce31521e9e065a01393de47ff14a49a..a52c940767634396090d94e3fb0fc9be72e1bd82 100644 |
--- a/cc/base/tiling_data.cc |
+++ b/cc/base/tiling_data.cc |
@@ -138,6 +138,23 @@ int TilingData::LastBorderTileYIndexFromSrcCoord(int src_position) const { |
return std::min(std::max(y, 0), num_tiles_y_ - 1); |
} |
+gfx::Rect TilingData::ExpandRectToTileBoundsWithBorders( |
+ const gfx::Rect rect) const { |
+ if (!rect.Intersects(tiling_rect_) || has_empty_bounds()) |
+ return gfx::Rect(); |
+ int index_x = FirstBorderTileXIndexFromSrcCoord(rect.x()); |
+ int index_y = FirstBorderTileYIndexFromSrcCoord(rect.y()); |
+ int index_right = LastBorderTileXIndexFromSrcCoord(rect.right()); |
+ int index_bottom = LastBorderTileYIndexFromSrcCoord(rect.bottom()); |
+ |
+ gfx::Rect rect_top_left(TileBoundsWithBorder(index_x, index_y)); |
+ gfx::Rect rect_bottom_right(TileBoundsWithBorder(index_right, index_bottom)); |
+ |
+ gfx::Rect expanded(rect_top_left); |
+ expanded.Union(rect_bottom_right); |
+ return expanded; |
+} |
+ |
gfx::Rect TilingData::TileBounds(int i, int j) const { |
AssertTile(i, j); |
int max_texture_size_x = max_texture_size_.width() - 2 * border_texels_; |