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

Side by Side 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 unit test build 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 unified diff | Download patch | Annotate | Revision Log
« cc/picture_layer.cc ('K') | « cc/picture_pile_base.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/picture_pile_base.h" 5 #include "cc/picture_pile_base.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace { 9 namespace {
10 // Dimensions of the tiles in this picture pile as well as the dimensions of 10 // Dimensions of the tiles in this picture pile as well as the dimensions of
11 // the base picture in each tile. 11 // the base picture in each tile.
12 const int kBasePictureSize = 3000; 12 const int kBasePictureSize = 3000;
13 const int kDefaultTileGridStride = 254;
13 } 14 }
14 15
15 namespace cc { 16 namespace cc {
16 17
17 PicturePileBase::PicturePileBase() 18 PicturePileBase::PicturePileBase()
18 : min_contents_scale_(0) { 19 : min_contents_scale_(0) {
19 tiling_.SetMaxTextureSize(gfx::Size(kBasePictureSize, kBasePictureSize)); 20 tiling_.SetMaxTextureSize(gfx::Size(kBasePictureSize, kBasePictureSize));
21 tile_grid_stride_.SetSize(kDefaultTileGridStride, kDefaultTileGridStride);
20 } 22 }
21 23
22 PicturePileBase::~PicturePileBase() { 24 PicturePileBase::~PicturePileBase() {
23 } 25 }
24 26
25 void PicturePileBase::Resize(gfx::Size new_size) { 27 void PicturePileBase::Resize(gfx::Size new_size) {
26 if (size() == new_size) 28 if (size() == new_size)
27 return; 29 return;
28 30
29 gfx::Size old_size = size(); 31 gfx::Size old_size = size();
(...skipping 30 matching lines...) Expand all
60 // 62 //
61 // For example, if a 1/4 contents scale is used, then that would be 3 buffer 63 // For example, if a 1/4 contents scale is used, then that would be 3 buffer
62 // pixels, since that's the minimum number of pixels to add so that resulting 64 // pixels, since that's the minimum number of pixels to add so that resulting
63 // content can be snapped to a four pixel aligned grid. 65 // content can be snapped to a four pixel aligned grid.
64 int buffer_pixels = static_cast<int>(ceil(1 / min_contents_scale) - 1); 66 int buffer_pixels = static_cast<int>(ceil(1 / min_contents_scale) - 1);
65 buffer_pixels = std::max(0, buffer_pixels); 67 buffer_pixels = std::max(0, buffer_pixels);
66 SetBufferPixels(buffer_pixels); 68 SetBufferPixels(buffer_pixels);
67 min_contents_scale_ = min_contents_scale; 69 min_contents_scale_ = min_contents_scale;
68 } 70 }
69 71
72 void PicturePileBase::SetTileGridStride(gfx::Size tile_grid_stride) {
73 DCHECK(tile_grid_stride.width() > 0);
74 DCHECK(tile_grid_stride.height() > 0);
75 tile_grid_stride_ = tile_grid_stride;
76 }
77
70 void PicturePileBase::SetBufferPixels(int new_buffer_pixels) { 78 void PicturePileBase::SetBufferPixels(int new_buffer_pixels) {
71 if (new_buffer_pixels == buffer_pixels()) 79 if (new_buffer_pixels == buffer_pixels())
72 return; 80 return;
73 81
74 Clear(); 82 Clear();
75 tiling_.SetBorderTexels(new_buffer_pixels); 83 tiling_.SetBorderTexels(new_buffer_pixels);
76 } 84 }
77 85
78 void PicturePileBase::Clear() { 86 void PicturePileBase::Clear() {
79 picture_list_map_.clear(); 87 picture_list_map_.clear();
80 } 88 }
81 89
82 void PicturePileBase::PushPropertiesTo(PicturePileBase* other) { 90 void PicturePileBase::PushPropertiesTo(PicturePileBase* other) {
83 other->picture_list_map_ = picture_list_map_; 91 other->picture_list_map_ = picture_list_map_;
84 other->tiling_ = tiling_; 92 other->tiling_ = tiling_;
85 other->recorded_region_ = recorded_region_; 93 other->recorded_region_ = recorded_region_;
86 other->min_contents_scale_ = min_contents_scale_; 94 other->min_contents_scale_ = min_contents_scale_;
95 other->tile_grid_stride_ = tile_grid_stride_;
87 } 96 }
88 97
89 void PicturePileBase::UpdateRecordedRegion() { 98 void PicturePileBase::UpdateRecordedRegion() {
90 recorded_region_.Clear(); 99 recorded_region_.Clear();
91 for (int x = 0; x < num_tiles_x(); ++x) { 100 for (int x = 0; x < num_tiles_x(); ++x) {
92 for (int y = 0; y < num_tiles_y(); ++y) { 101 for (int y = 0; y < num_tiles_y(); ++y) {
93 if (!HasRecordingAt(x, y)) 102 if (!HasRecordingAt(x, y))
94 continue; 103 continue;
95 recorded_region_.Union(tile_bounds(x, y)); 104 recorded_region_.Union(tile_bounds(x, y));
96 } 105 }
97 } 106 }
98 } 107 }
99 108
100 bool PicturePileBase::HasRecordingAt(int x, int y) { 109 bool PicturePileBase::HasRecordingAt(int x, int y) {
101 PictureListMap::iterator found = 110 PictureListMap::iterator found =
102 picture_list_map_.find(PictureListMapKey(x, y)); 111 picture_list_map_.find(PictureListMapKey(x, y));
103 if (found == picture_list_map_.end()) 112 if (found == picture_list_map_.end())
104 return false; 113 return false;
105 DCHECK(!found->second.empty()); 114 DCHECK(!found->second.empty());
106 return true; 115 return true;
107 } 116 }
108 117
109 } // namespace cc 118 } // namespace cc
OLDNEW
« 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