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

Side by Side Diff: cc/picture_layer_tiling_set.cc

Issue 12220133: cc: Stretch textures by .5 texels to prevent out of bounds sampling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix cc_unittests 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
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/picture_layer_tiling_set.h" 5 #include "cc/picture_layer_tiling_set.h"
6 6
7 namespace cc { 7 namespace cc {
8 8
9 namespace { 9 namespace {
10 10
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 void PictureLayerTilingSet::CreateTilesFromLayerRect(gfx::Rect layer_rect) { 100 void PictureLayerTilingSet::CreateTilesFromLayerRect(gfx::Rect layer_rect) {
101 for (size_t i = 0; i < tilings_.size(); ++i) 101 for (size_t i = 0; i < tilings_.size(); ++i)
102 tilings_[i]->CreateTilesFromLayerRect(layer_rect); 102 tilings_[i]->CreateTilesFromLayerRect(layer_rect);
103 } 103 }
104 104
105 PictureLayerTilingSet::Iterator::Iterator( 105 PictureLayerTilingSet::Iterator::Iterator(
106 const PictureLayerTilingSet* set, 106 const PictureLayerTilingSet* set,
107 float contents_scale, 107 float contents_scale,
108 gfx::Rect content_rect, 108 gfx::Rect content_rect,
109 float ideal_contents_scale) 109 float ideal_contents_scale,
110 PictureLayerTiling::LayerDeviceAlignment layerDeviceAlignment)
110 : set_(set), 111 : set_(set),
111 contents_scale_(contents_scale), 112 contents_scale_(contents_scale),
112 ideal_contents_scale_(ideal_contents_scale), 113 ideal_contents_scale_(ideal_contents_scale),
114 layer_device_alignment_(layerDeviceAlignment),
113 current_tiling_(-1) { 115 current_tiling_(-1) {
114 missing_region_.Union(content_rect); 116 missing_region_.Union(content_rect);
115 117
116 for (ideal_tiling_ = 0; 118 for (ideal_tiling_ = 0;
117 static_cast<size_t>(ideal_tiling_) < set_->tilings_.size(); 119 static_cast<size_t>(ideal_tiling_) < set_->tilings_.size();
118 ++ideal_tiling_) { 120 ++ideal_tiling_) {
119 PictureLayerTiling* tiling = set_->tilings_[ideal_tiling_]; 121 PictureLayerTiling* tiling = set_->tilings_[ideal_tiling_];
120 if (tiling->contents_scale() < ideal_contents_scale_) { 122 if (tiling->contents_scale() < ideal_contents_scale_) {
121 if (ideal_tiling_ > 0) 123 if (ideal_tiling_ > 0)
122 ideal_tiling_--; 124 ideal_tiling_--;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 237
236 // Done, found next checkerboard rect to return. 238 // Done, found next checkerboard rect to return.
237 if (current_tiling_ >= static_cast<int>(set_->tilings_.size())) 239 if (current_tiling_ >= static_cast<int>(set_->tilings_.size()))
238 return *this; 240 return *this;
239 241
240 // Construct a new iterator for the next tiling, but we need to loop 242 // Construct a new iterator for the next tiling, but we need to loop
241 // again until we get to a valid one. 243 // again until we get to a valid one.
242 tiling_iter_ = PictureLayerTiling::Iterator( 244 tiling_iter_ = PictureLayerTiling::Iterator(
243 set_->tilings_[current_tiling_], 245 set_->tilings_[current_tiling_],
244 contents_scale_, 246 contents_scale_,
245 last_rect); 247 last_rect,
248 layer_device_alignment_);
246 } 249 }
247 250
248 return *this; 251 return *this;
249 } 252 }
250 253
251 PictureLayerTilingSet::Iterator::operator bool() const { 254 PictureLayerTilingSet::Iterator::operator bool() const {
252 return current_tiling_ < static_cast<int>(set_->tilings_.size()) || 255 return current_tiling_ < static_cast<int>(set_->tilings_.size()) ||
253 region_iter_.has_rect(); 256 region_iter_.has_rect();
254 } 257 }
255 258
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 current_frame_time); 292 current_frame_time);
290 } 293 }
291 } 294 }
292 295
293 void PictureLayerTilingSet::DidBecomeActive() { 296 void PictureLayerTilingSet::DidBecomeActive() {
294 for (size_t i = 0; i < tilings_.size(); ++i) 297 for (size_t i = 0; i < tilings_.size(); ++i)
295 tilings_[i]->DidBecomeActive(); 298 tilings_[i]->DidBecomeActive();
296 } 299 }
297 300
298 } // namespace cc 301 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698