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

Unified Diff: cc/picture_pile_base.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: Fixing copy pasta 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
« cc/picture_layer.cc ('K') | « cc/picture_pile_base.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« cc/picture_layer.cc ('K') | « cc/picture_pile_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698