Index: cc/picture_pile_base.cc |
diff --git a/cc/picture_pile_base.cc b/cc/picture_pile_base.cc |
index 94983847afcc63ff943c57bb82b547c3a160243e..7669fe7ce430e2fb36ace5bec5119a4d868ad9eb 100644 |
--- a/cc/picture_pile_base.cc |
+++ b/cc/picture_pile_base.cc |
@@ -5,11 +5,13 @@ |
#include "cc/picture_pile_base.h" |
#include "base/logging.h" |
+#include "cc/layer_tree_settings.h" |
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 kTileGridBorderPixels = 1; |
} |
namespace cc { |
@@ -17,6 +19,9 @@ namespace cc { |
PicturePileBase::PicturePileBase() |
: min_contents_scale_(0) { |
tiling_.SetMaxTextureSize(gfx::Size(kBasePictureSize, kBasePictureSize)); |
+ tile_grid_info_.fTileInterval.setEmpty(); |
+ tile_grid_info_.fMargin.setEmpty(); |
+ tile_grid_info_.fOffset.setZero(); |
} |
PicturePileBase::~PicturePileBase() { |
@@ -67,6 +72,23 @@ void PicturePileBase::SetMinContentsScale(float min_contents_scale) { |
min_contents_scale_ = min_contents_scale; |
} |
+void PicturePileBase::ApplyLayerTreeSettings( |
+ const LayerTreeSettings& settings) { |
+ SetMinContentsScale(settings.minimumContentsScale); |
+ tile_grid_info_.fTileInterval.set( |
+ settings.defaultTileSize.width() - 2 * kTileGridBorderPixels, |
+ settings.defaultTileSize.height() - 2 * kTileGridBorderPixels); |
+ DCHECK_GT(tile_grid_info_.fTileInterval.width(), 0); |
+ DCHECK_GT(tile_grid_info_.fTileInterval.height(), 0); |
+ tile_grid_info_.fMargin.set(kTileGridBorderPixels, |
+ kTileGridBorderPixels); |
+ // 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. |
+ tile_grid_info_.fOffset.set(-kTileGridBorderPixels, |
+ -kTileGridBorderPixels); |
+} |
+ |
void PicturePileBase::SetBufferPixels(int new_buffer_pixels) { |
if (new_buffer_pixels == buffer_pixels()) |
return; |
@@ -84,6 +106,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() { |