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

Unified Diff: cc/tiling_data.cc

Issue 12221077: Fixing tile grid size used by cc:Picture to make it respect current tile configuration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
« no previous file with comments | « cc/tiling_data.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tiling_data.cc
diff --git a/cc/tiling_data.cc b/cc/tiling_data.cc
index 357c17b4a05f174c0ac6162708ba906aeb834485..c64bb1f8ab4858a438b0b2f7f3bfbb269e81124b 100644
--- a/cc/tiling_data.cc
+++ b/cc/tiling_data.cc
@@ -68,9 +68,9 @@ int TilingData::TileXIndexFromSrcCoord(int src_position) const {
if (num_tiles_x_ <= 1)
return 0;
- DCHECK_GT(max_texture_size_.width() - 2 * border_texels_, 0);
+ DCHECK_GT(inner_tile_size_.width(), 0);
int x = (src_position - border_texels_) /
- (max_texture_size_.width() - 2 * border_texels_);
+ (inner_tile_size_.width());
return std::min(std::max(x, 0), num_tiles_x_ - 1);
}
@@ -78,9 +78,9 @@ int TilingData::TileYIndexFromSrcCoord(int src_position) const {
if (num_tiles_y_ <= 1)
return 0;
- DCHECK_GT(max_texture_size_.height() - 2 * border_texels_, 0);
+ DCHECK_GT(inner_tile_size_.height(), 0);
int y = (src_position - border_texels_) /
- (max_texture_size_.height() - 2 * border_texels_);
+ (inner_tile_size_.height());
return std::min(std::max(y, 0), num_tiles_y_ - 1);
}
@@ -88,9 +88,8 @@ int TilingData::FirstBorderTileXIndexFromSrcCoord(int src_position) const {
if (num_tiles_x_ <= 1)
return 0;
- DCHECK_GT(max_texture_size_.width() - 2 * border_texels_, 0);
- int inner_tile_size = max_texture_size_.width() - 2 * border_texels_;
- int x = (src_position - 2 * border_texels_) / inner_tile_size;
+ DCHECK_GT(inner_tile_size_.width(), 0);
+ int x = (src_position - 2 * border_texels_) / inner_tile_size_.width();
return std::min(std::max(x, 0), num_tiles_x_ - 1);
}
@@ -98,9 +97,8 @@ int TilingData::FirstBorderTileYIndexFromSrcCoord(int src_position) const {
if (num_tiles_y_ <= 1)
return 0;
- DCHECK_GT(max_texture_size_.height() - 2 * border_texels_, 0);
- int inner_tile_size = max_texture_size_.height() - 2 * border_texels_;
- int y = (src_position - 2 * border_texels_) / inner_tile_size;
+ DCHECK_GT(inner_tile_size_.height(), 0);
+ int y = (src_position - 2 * border_texels_) / inner_tile_size_.height();
return std::min(std::max(y, 0), num_tiles_y_ - 1);
}
@@ -108,9 +106,8 @@ int TilingData::LastBorderTileXIndexFromSrcCoord(int src_position) const {
if (num_tiles_x_ <= 1)
return 0;
- DCHECK_GT(max_texture_size_.width() - 2 * border_texels_, 0);
- int inner_tile_size = max_texture_size_.width() - 2 * border_texels_;
- int x = src_position / inner_tile_size;
+ DCHECK_GT(inner_tile_size_.width(), 0);
+ int x = src_position / inner_tile_size_.width();
return std::min(std::max(x, 0), num_tiles_x_ - 1);
}
@@ -118,16 +115,15 @@ int TilingData::LastBorderTileYIndexFromSrcCoord(int src_position) const {
if (num_tiles_y_ <= 1)
return 0;
- DCHECK_GT(max_texture_size_.height() - 2 * border_texels_, 0);
- int inner_tile_size = max_texture_size_.height() - 2 * border_texels_;
- int y = src_position / inner_tile_size;
+ DCHECK_GT(inner_tile_size_.height(), 0);
+ int y = src_position / inner_tile_size_.height();
return std::min(std::max(y, 0), num_tiles_y_ - 1);
}
gfx::Rect TilingData::TileBounds(int i, int j) const {
AssertTile(i, 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 max_texture_size_x = inner_tile_size_.width();
+ int max_texture_size_y = inner_tile_size_.height();
int total_size_x = total_size_.width();
int total_size_y = total_size_.height();
@@ -192,7 +188,7 @@ int TilingData::TilePositionX(int x_index) const {
DCHECK_GE(x_index, 0);
DCHECK_LT(x_index, num_tiles_x_);
- int pos = (max_texture_size_.width() - 2 * border_texels_) * x_index;
+ int pos = inner_tile_size_.width() * x_index;
if (x_index != 0)
pos += border_texels_;
@@ -203,7 +199,7 @@ int TilingData::TilePositionY(int y_index) const {
DCHECK_GE(y_index, 0);
DCHECK_LT(y_index, num_tiles_y_);
- int pos = (max_texture_size_.height() - 2 * border_texels_) * y_index;
+ int pos = inner_tile_size_.height() * y_index;
if (y_index != 0)
pos += border_texels_;
@@ -219,7 +215,7 @@ int TilingData::TileSizeX(int x_index) const {
if (!x_index && num_tiles_x_ > 1)
return max_texture_size_.width() - border_texels_;
danakj 2013/02/07 20:40:01 I'm not sure about the inner_tile_size concept bec
if (x_index < num_tiles_x_ - 1)
- return max_texture_size_.width() - 2 * border_texels_;
+ return inner_tile_size_.width();
if (x_index == num_tiles_x_ - 1)
return total_size_.width() - TilePositionX(x_index);
@@ -236,7 +232,7 @@ int TilingData::TileSizeY(int y_index) const {
if (!y_index && num_tiles_y_ > 1)
return max_texture_size_.height() - border_texels_;
if (y_index < num_tiles_y_ - 1)
- return max_texture_size_.height() - 2 * border_texels_;
+ return inner_tile_size_.height();
if (y_index == num_tiles_y_ - 1)
return total_size_.height() - TilePositionY(y_index);
@@ -252,6 +248,8 @@ gfx::Vector2d TilingData::TextureOffset(int x_index, int y_index) const {
}
void TilingData::RecomputeNumTiles() {
+ inner_tile_size_ = max_texture_size_;
+ inner_tile_size_.Enlarge(- 2 * border_texels_, - 2 * border_texels_);
num_tiles_x_ = ComputeNumTiles(max_texture_size_.width(), total_size_.width(), border_texels_);
num_tiles_y_ = ComputeNumTiles(max_texture_size_.height(), total_size_.height(), border_texels_);
}
« no previous file with comments | « cc/tiling_data.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698