Chromium Code Reviews| Index: cc/picture_pile_base.cc |
| diff --git a/cc/picture_pile_base.cc b/cc/picture_pile_base.cc |
| index 94983847afcc63ff943c57bb82b547c3a160243e..ac0658267a9ff952c42bc21c2961166c76ea277e 100644 |
| --- a/cc/picture_pile_base.cc |
| +++ b/cc/picture_pile_base.cc |
| @@ -5,11 +5,15 @@ |
| #include "cc/picture_pile_base.h" |
| #include "base/logging.h" |
| +#include "cc/layer_tree_host.h" |
| +#include "cc/layer_tree_host_impl.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 kDefaultTileGridInterval = 254; |
|
enne (OOO)
2013/02/25 23:59:15
This should never get used, right? If possible, I'
|
| +const int kDefaultTileGridBorderPixels = 1; |
| } |
| namespace cc { |
| @@ -17,6 +21,12 @@ namespace cc { |
| PicturePileBase::PicturePileBase() |
| : min_contents_scale_(0) { |
| tiling_.SetMaxTextureSize(gfx::Size(kBasePictureSize, kBasePictureSize)); |
| + tile_grid_info_.fTileInterval.set(kDefaultTileGridInterval, |
| + kDefaultTileGridInterval); |
| + tile_grid_info_.fMargin.set(kDefaultTileGridBorderPixels, |
| + kDefaultTileGridBorderPixels); |
| + tile_grid_info_.fOffset.set(-kDefaultTileGridBorderPixels, |
| + -kDefaultTileGridBorderPixels); |
| } |
| PicturePileBase::~PicturePileBase() { |
| @@ -67,6 +77,32 @@ void PicturePileBase::SetMinContentsScale(float min_contents_scale) { |
| min_contents_scale_ = min_contents_scale; |
| } |
| +void PicturePileBase::ApplyLayerTreeSettings(LayerTreeHost* host) { |
| + ApplyLayerTreeSettings(host->settings(), host->deviceScaleFactor()); |
| +} |
| + |
| +void PicturePileBase::ApplyLayerTreeSettings(LayerTreeHostImpl* host_impl) { |
| + ApplyLayerTreeSettings(host_impl->settings(), |
| + host_impl->deviceScaleFactor()); |
| +} |
| + |
| +void PicturePileBase::ApplyLayerTreeSettings( |
| + const LayerTreeSettings& settings, float deviceScaleFactor) { |
| + SetMinContentsScale(settings.minimumContentsScale); |
| + tile_grid_info_.fTileInterval.set( |
| + settings.defaultTileSize.width() - 2 * kDefaultTileGridBorderPixels, |
| + settings.defaultTileSize.height() - 2 * kDefaultTileGridBorderPixels); |
| + DCHECK_GT(tile_grid_info_.fTileInterval.width(), 0); |
| + DCHECK_GT(tile_grid_info_.fTileInterval.height(), 0); |
| + tile_grid_info_.fMargin.set(kDefaultTileGridBorderPixels, |
| + kDefaultTileGridBorderPixels); |
| + // 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(-kDefaultTileGridBorderPixels, |
| + -kDefaultTileGridBorderPixels); |
| +} |
| + |
| void PicturePileBase::SetBufferPixels(int new_buffer_pixels) { |
| if (new_buffer_pixels == buffer_pixels()) |
| return; |
| @@ -84,6 +120,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() { |