Index: cc/picture_pile_base.cc |
diff --git a/cc/picture_pile_base.cc b/cc/picture_pile_base.cc |
index 94983847afcc63ff943c57bb82b547c3a160243e..50f7f6e3ff7c48285635fea8da2b8cf200abf273 100644 |
--- a/cc/picture_pile_base.cc |
+++ b/cc/picture_pile_base.cc |
@@ -10,6 +10,8 @@ namespace { |
// Dimensions of the tiles in this picture pile as well as the dimensions of |
// the base picture in each tile. |
const int kBasePictureSize = 3000; |
+const int kDefaultTileGridSize = 256; |
+const int kDefaultTileGridBorderPixels = 1; |
} |
namespace cc { |
@@ -17,6 +19,8 @@ namespace cc { |
PicturePileBase::PicturePileBase() |
: min_contents_scale_(0) { |
tiling_.SetMaxTextureSize(gfx::Size(kBasePictureSize, kBasePictureSize)); |
+ SetTileGridSize(gfx::Size(kDefaultTileGridSize, kDefaultTileGridSize), |
+ kDefaultTileGridBorderPixels); |
} |
PicturePileBase::~PicturePileBase() { |
@@ -67,6 +71,18 @@ void PicturePileBase::SetMinContentsScale(float min_contents_scale) { |
min_contents_scale_ = min_contents_scale; |
} |
+void PicturePileBase::SetTileGridSize(gfx::Size tile_size, int borderPixels) { |
+ DCHECK(tile_size.width() - 2 * borderPixels > 0); |
+ DCHECK(tile_size.height() - 2 * borderPixels > 0); |
+ tile_grid_info_.fTileInterval.set(tile_size.width() - 2 * borderPixels, |
+ tile_size.height() - 2 * borderPixels); |
+ tile_grid_info_.fMargin.set(borderPixels, borderPixels); |
+ // Offset the tile grid coordinate space to take into account the fact |
+ // that the top-most and left-most tiles do not have top and left borders |
+ // respectively. This offset |
+ tile_grid_info_.fOffset.set(-borderPixels, -borderPixels); |
+} |
+ |
void PicturePileBase::SetBufferPixels(int new_buffer_pixels) { |
if (new_buffer_pixels == buffer_pixels()) |
return; |
@@ -84,6 +100,7 @@ void PicturePileBase::PushPropertiesTo(PicturePileBase* other) { |
other->tiling_ = tiling_; |
other->recorded_region_ = recorded_region_; |
other->min_contents_scale_ = min_contents_scale_; |
+ other->tile_grid_info_ = tile_grid_info_; |
} |
void PicturePileBase::UpdateRecordedRegion() { |