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

Side by Side Diff: cc/resources/picture_layer_tiling.cc

Issue 12583018: cc: Rename PictureLayerTiling(Set) Iterator to CoverageIterator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 9 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
« no previous file with comments | « cc/resources/picture_layer_tiling.h ('k') | cc/resources/picture_layer_tiling_set.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/resources/picture_layer_tiling.h" 5 #include "cc/resources/picture_layer_tiling.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 std::vector<TileMapKey> new_tiles; 130 std::vector<TileMapKey> new_tiles;
131 131
132 for (Region::Iterator region_iter(layer_invalidation); 132 for (Region::Iterator region_iter(layer_invalidation);
133 region_iter.has_rect(); 133 region_iter.has_rect();
134 region_iter.next()) { 134 region_iter.next()) {
135 gfx::Rect layer_invalidation = region_iter.rect(); 135 gfx::Rect layer_invalidation = region_iter.rect();
136 layer_invalidation.Intersect(gfx::Rect(layer_bounds_)); 136 layer_invalidation.Intersect(gfx::Rect(layer_bounds_));
137 gfx::Rect rect = 137 gfx::Rect rect =
138 gfx::ToEnclosingRect(ScaleRect(layer_invalidation, contents_scale_)); 138 gfx::ToEnclosingRect(ScaleRect(layer_invalidation, contents_scale_));
139 139
140 for (PictureLayerTiling::Iterator tile_iter(this, contents_scale_, rect); 140 for (PictureLayerTiling::CoverageIterator tile_iter(this,
141 contents_scale_,
142 rect);
141 tile_iter; 143 tile_iter;
142 ++tile_iter) { 144 ++tile_iter) {
143 TileMapKey key(tile_iter.tile_i_, tile_iter.tile_j_); 145 TileMapKey key(tile_iter.tile_i_, tile_iter.tile_j_);
144 TileMap::iterator found = tiles_.find(key); 146 TileMap::iterator found = tiles_.find(key);
145 if (found == tiles_.end()) 147 if (found == tiles_.end())
146 continue; 148 continue;
147 149
148 tiles_.erase(found); 150 tiles_.erase(found);
149 new_tiles.push_back(key); 151 new_tiles.push_back(key);
150 } 152 }
(...skipping 13 matching lines...) Expand all
164 for (TilingData::Iterator iter(&tiling_data_, content_rect); iter; ++iter) { 166 for (TilingData::Iterator iter(&tiling_data_, content_rect); iter; ++iter) {
165 TileMap::iterator found = 167 TileMap::iterator found =
166 tiles_.find(TileMapKey(iter.index_x(), iter.index_y())); 168 tiles_.find(TileMapKey(iter.index_x(), iter.index_y()));
167 // Ignore any tiles that already exist. 169 // Ignore any tiles that already exist.
168 if (found != tiles_.end()) 170 if (found != tiles_.end())
169 continue; 171 continue;
170 CreateTile(iter.index_x(), iter.index_y()); 172 CreateTile(iter.index_x(), iter.index_y());
171 } 173 }
172 } 174 }
173 175
174 PictureLayerTiling::Iterator::Iterator() 176 PictureLayerTiling::CoverageIterator::CoverageIterator()
175 : tiling_(NULL), 177 : tiling_(NULL),
176 current_tile_(NULL), 178 current_tile_(NULL),
177 tile_i_(0), 179 tile_i_(0),
178 tile_j_(0), 180 tile_j_(0),
179 left_(0), 181 left_(0),
180 top_(0), 182 top_(0),
181 right_(-1), 183 right_(-1),
182 bottom_(-1) { 184 bottom_(-1) {
183 } 185 }
184 186
185 PictureLayerTiling::Iterator::Iterator(const PictureLayerTiling* tiling, 187 PictureLayerTiling::CoverageIterator::CoverageIterator(
186 float dest_scale, 188 const PictureLayerTiling* tiling,
187 gfx::Rect dest_rect) 189 float dest_scale,
190 gfx::Rect dest_rect)
188 : tiling_(tiling), 191 : tiling_(tiling),
189 dest_rect_(dest_rect), 192 dest_rect_(dest_rect),
190 dest_to_content_scale_(0), 193 dest_to_content_scale_(0),
191 current_tile_(NULL), 194 current_tile_(NULL),
192 tile_i_(0), 195 tile_i_(0),
193 tile_j_(0), 196 tile_j_(0),
194 left_(0), 197 left_(0),
195 top_(0), 198 top_(0),
196 right_(-1), 199 right_(-1),
197 bottom_(-1) { 200 bottom_(-1) {
(...skipping 23 matching lines...) Expand all
221 right_ = tiling_->tiling_data_.TileXIndexFromSrcCoord( 224 right_ = tiling_->tiling_data_.TileXIndexFromSrcCoord(
222 content_rect.right() - 1); 225 content_rect.right() - 1);
223 bottom_ = tiling_->tiling_data_.TileYIndexFromSrcCoord( 226 bottom_ = tiling_->tiling_data_.TileYIndexFromSrcCoord(
224 content_rect.bottom() - 1); 227 content_rect.bottom() - 1);
225 228
226 tile_i_ = left_ - 1; 229 tile_i_ = left_ - 1;
227 tile_j_ = top_; 230 tile_j_ = top_;
228 ++(*this); 231 ++(*this);
229 } 232 }
230 233
231 PictureLayerTiling::Iterator::~Iterator() { 234 PictureLayerTiling::CoverageIterator::~CoverageIterator() {
232 } 235 }
233 236
234 PictureLayerTiling::Iterator& PictureLayerTiling::Iterator::operator++() { 237 PictureLayerTiling::CoverageIterator&
238 PictureLayerTiling::CoverageIterator::operator++() {
235 if (tile_j_ > bottom_) 239 if (tile_j_ > bottom_)
236 return *this; 240 return *this;
237 241
238 bool first_time = tile_i_ < left_; 242 bool first_time = tile_i_ < left_;
239 bool new_row = false; 243 bool new_row = false;
240 tile_i_++; 244 tile_i_++;
241 if (tile_i_ > right_) { 245 if (tile_i_ > right_) {
242 tile_i_ = left_; 246 tile_i_ = left_;
243 tile_j_++; 247 tile_j_++;
244 new_row = true; 248 new_row = true;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 289
286 if (!new_row) { 290 if (!new_row) {
287 DCHECK_EQ(last_geometry_rect.right(), current_geometry_rect_.x()); 291 DCHECK_EQ(last_geometry_rect.right(), current_geometry_rect_.x());
288 DCHECK_EQ(last_geometry_rect.bottom(), current_geometry_rect_.bottom()); 292 DCHECK_EQ(last_geometry_rect.bottom(), current_geometry_rect_.bottom());
289 DCHECK_EQ(last_geometry_rect.y(), current_geometry_rect_.y()); 293 DCHECK_EQ(last_geometry_rect.y(), current_geometry_rect_.y());
290 } 294 }
291 295
292 return *this; 296 return *this;
293 } 297 }
294 298
295 gfx::Rect PictureLayerTiling::Iterator::geometry_rect() const { 299 gfx::Rect PictureLayerTiling::CoverageIterator::geometry_rect() const {
296 return current_geometry_rect_; 300 return current_geometry_rect_;
297 } 301 }
298 302
299 gfx::Rect PictureLayerTiling::Iterator::full_tile_geometry_rect() const { 303 gfx::Rect
304 PictureLayerTiling::CoverageIterator::full_tile_geometry_rect() const {
300 gfx::Rect rect = tiling_->tiling_data_.TileBoundsWithBorder(tile_i_, tile_j_); 305 gfx::Rect rect = tiling_->tiling_data_.TileBoundsWithBorder(tile_i_, tile_j_);
301 rect.set_size(tiling_->tiling_data_.max_texture_size()); 306 rect.set_size(tiling_->tiling_data_.max_texture_size());
302 return rect; 307 return rect;
303 } 308 }
304 309
305 gfx::RectF PictureLayerTiling::Iterator::texture_rect() const { 310 gfx::RectF PictureLayerTiling::CoverageIterator::texture_rect() const {
306 gfx::PointF tex_origin = 311 gfx::PointF tex_origin =
307 tiling_->tiling_data_.TileBoundsWithBorder(tile_i_, tile_j_).origin(); 312 tiling_->tiling_data_.TileBoundsWithBorder(tile_i_, tile_j_).origin();
308 313
309 // Convert from dest space => content space => texture space. 314 // Convert from dest space => content space => texture space.
310 gfx::RectF texture_rect(current_geometry_rect_); 315 gfx::RectF texture_rect(current_geometry_rect_);
311 texture_rect.Scale(dest_to_content_scale_, 316 texture_rect.Scale(dest_to_content_scale_,
312 dest_to_content_scale_); 317 dest_to_content_scale_);
313 texture_rect.Offset(-tex_origin.OffsetFromOrigin()); 318 texture_rect.Offset(-tex_origin.OffsetFromOrigin());
314 texture_rect.Intersect(tiling_->ContentRect()); 319 texture_rect.Intersect(tiling_->ContentRect());
315 320
316 return texture_rect; 321 return texture_rect;
317 } 322 }
318 323
319 gfx::Size PictureLayerTiling::Iterator::texture_size() const { 324 gfx::Size PictureLayerTiling::CoverageIterator::texture_size() const {
320 return tiling_->tiling_data_.max_texture_size(); 325 return tiling_->tiling_data_.max_texture_size();
321 } 326 }
322 327
323 void PictureLayerTiling::UpdateTilePriorities( 328 void PictureLayerTiling::UpdateTilePriorities(
324 WhichTree tree, 329 WhichTree tree,
325 gfx::Size device_viewport, 330 gfx::Size device_viewport,
326 const gfx::RectF& viewport_in_layer_space, 331 const gfx::RectF& viewport_in_layer_space,
327 gfx::Size last_layer_bounds, 332 gfx::Size last_layer_bounds,
328 gfx::Size current_layer_bounds, 333 gfx::Size current_layer_bounds,
329 float last_layer_contents_scale, 334 float last_layer_contents_scale,
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 608
604 // If our delta is less then our event distance, we're done. 609 // If our delta is less then our event distance, we're done.
605 if (delta < event.distance) 610 if (delta < event.distance)
606 break; 611 break;
607 } 612 }
608 613
609 return gfx::Rect(origin_x, origin_y, width, height); 614 return gfx::Rect(origin_x, origin_y, width, height);
610 } 615 }
611 616
612 } // namespace cc 617 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_layer_tiling.h ('k') | cc/resources/picture_layer_tiling_set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698