Index: cc/base/tiling_data.cc |
diff --git a/cc/base/tiling_data.cc b/cc/base/tiling_data.cc |
index 98397e55ccfbb918b117e8c260ce088da6eabb9e..f8aa8351109b8498d0678619f045bbc02d565a41 100644 |
--- a/cc/base/tiling_data.cc |
+++ b/cc/base/tiling_data.cc |
@@ -91,6 +91,36 @@ int TilingData::TileYIndexFromSrcCoord(int src_position) const { |
return std::min(std::max(y, 0), num_tiles_y_ - 1); |
} |
+int TilingData::TileAbsoluteXIndexFromSrcCoord(int src_position) const { |
+ int inner_tile_width = max_texture_size_.width() - 2 * border_texels_; |
+ if (inner_tile_width <= 0) |
+ return 0; |
+ |
+ int max_width = inner_tile_width * num_tiles_x_ + 2 * border_texels_; |
+ if (src_position >= 0 && src_position < max_width) |
+ return TileXIndexFromSrcCoord(src_position); |
+ |
+ if (src_position >= max_width) |
+ return num_tiles_x_ + (src_position - max_width) / inner_tile_width; |
+ |
+ return (src_position + 1) / inner_tile_width - 1; |
+} |
+ |
+int TilingData::TileAbsoluteYIndexFromSrcCoord(int src_position) const { |
+ int inner_tile_height = max_texture_size_.height() - 2 * border_texels_; |
+ if (inner_tile_height <= 0) |
+ return 0; |
+ |
+ int max_height = inner_tile_height * num_tiles_y_ + 2 * border_texels_; |
+ if (src_position >= 0 && src_position < max_height) |
+ return TileYIndexFromSrcCoord(src_position); |
+ |
+ if (src_position >= max_height) |
+ return num_tiles_y_ + (src_position - max_height) / inner_tile_height; |
+ |
+ return (src_position + 1) / inner_tile_height - 1; |
+} |
+ |
int TilingData::FirstBorderTileXIndexFromSrcCoord(int src_position) const { |
if (num_tiles_x_ <= 1) |
return 0; |