Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(578)

Unified Diff: cc/tiling_data.cc

Issue 12084031: A host of micro-optimizations and a refactor of TimeForBoundsToIntersect (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/tiling_data.cc
diff --git a/cc/tiling_data.cc b/cc/tiling_data.cc
index e11e8dbd1fe47e35d6ce8460cd8e28cf5b32bb75..748a1a8e8412584b5b98b738bd3d7733c3ae061f 100644
--- a/cc/tiling_data.cc
+++ b/cc/tiling_data.cc
@@ -101,10 +101,35 @@ int TilingData::BorderTileYIndexFromSrcCoord(int src_position) const {
gfx::Rect TilingData::TileBounds(int i, int j) const {
AssertTile(i, j);
- int x = TilePositionX(i);
- int y = TilePositionY(j);
- int width = TileSizeX(i);
- int height = TileSizeY(j);
+ int max_texture_size_x = max_texture_size_.width() - 2 * border_texels_;
+ int max_texture_size_y = max_texture_size_.height() - 2 * border_texels_;
+ int total_size_x = total_size_.width();
+ int total_size_y = total_size_.height();
+
+ int lo_x = max_texture_size_x * i;
+ if (i != 0)
+ lo_x += border_texels_;
+
+ int lo_y = max_texture_size_y * j;
+ if (j != 0)
+ lo_y += border_texels_;
+
+ int hi_x = max_texture_size_x * (i + 1) + border_texels_;
+ if (i + 1 == num_tiles_x_)
+ hi_x += border_texels_;
+ if (hi_x > total_size_x)
+ hi_x = total_size_x;
+
+ int hi_y = max_texture_size_y * (j + 1) + border_texels_;
+ if (j + 1 == num_tiles_y_)
+ hi_y += border_texels_;
+ if (hi_y > total_size_y)
+ hi_y = total_size_y;
+
+ int x = lo_x;
+ int y = lo_y;
+ int width = hi_x - lo_x;
+ int height = hi_y - lo_y;
DCHECK_GE(x, 0);
DCHECK_GE(y, 0);
DCHECK_GE(width, 0);
« cc/picture_layer_tiling.cc ('K') | « cc/tile_priority.cc ('k') | ui/gfx/rect_f.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698