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

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

Issue 638353002: [C++11 Allowed Features] Declares a type-safe null pointer converting from NULL to nullptr in src/… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formating. Created 6 years, 2 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
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_set.h" 5 #include "cc/resources/picture_layer_tiling_set.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 namespace cc { 9 namespace cc {
10 10
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 num_high_res++; 123 num_high_res++;
124 } 124 }
125 return num_high_res; 125 return num_high_res;
126 } 126 }
127 127
128 PictureLayerTiling* PictureLayerTilingSet::TilingAtScale(float scale) const { 128 PictureLayerTiling* PictureLayerTilingSet::TilingAtScale(float scale) const {
129 for (size_t i = 0; i < tilings_.size(); ++i) { 129 for (size_t i = 0; i < tilings_.size(); ++i) {
130 if (tilings_[i]->contents_scale() == scale) 130 if (tilings_[i]->contents_scale() == scale)
131 return tilings_[i]; 131 return tilings_[i];
132 } 132 }
133 return NULL; 133 return nullptr;
134 } 134 }
135 135
136 void PictureLayerTilingSet::RemoveAllTilings() { 136 void PictureLayerTilingSet::RemoveAllTilings() {
137 tilings_.clear(); 137 tilings_.clear();
138 } 138 }
139 139
140 void PictureLayerTilingSet::Remove(PictureLayerTiling* tiling) { 140 void PictureLayerTilingSet::Remove(PictureLayerTiling* tiling) {
141 ScopedPtrVector<PictureLayerTiling>::iterator iter = 141 ScopedPtrVector<PictureLayerTiling>::iterator iter =
142 std::find(tilings_.begin(), tilings_.end(), tiling); 142 std::find(tilings_.begin(), tilings_.end(), tiling);
143 if (iter == tilings_.end()) 143 if (iter == tilings_.end())
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 } 201 }
202 202
203 gfx::Size PictureLayerTilingSet::CoverageIterator::texture_size() const { 203 gfx::Size PictureLayerTilingSet::CoverageIterator::texture_size() const {
204 if (!tiling_iter_) 204 if (!tiling_iter_)
205 return gfx::Size(); 205 return gfx::Size();
206 return tiling_iter_.texture_size(); 206 return tiling_iter_.texture_size();
207 } 207 }
208 208
209 Tile* PictureLayerTilingSet::CoverageIterator::operator->() const { 209 Tile* PictureLayerTilingSet::CoverageIterator::operator->() const {
210 if (!tiling_iter_) 210 if (!tiling_iter_)
211 return NULL; 211 return nullptr;
212 return *tiling_iter_; 212 return *tiling_iter_;
213 } 213 }
214 214
215 Tile* PictureLayerTilingSet::CoverageIterator::operator*() const { 215 Tile* PictureLayerTilingSet::CoverageIterator::operator*() const {
216 if (!tiling_iter_) 216 if (!tiling_iter_)
217 return NULL; 217 return nullptr;
218 return *tiling_iter_; 218 return *tiling_iter_;
219 } 219 }
220 220
221 TileResolution PictureLayerTilingSet::CoverageIterator::resolution() const { 221 TileResolution PictureLayerTilingSet::CoverageIterator::resolution() const {
222 const PictureLayerTiling* tiling = CurrentTiling(); 222 const PictureLayerTiling* tiling = CurrentTiling();
223 DCHECK(tiling); 223 DCHECK(tiling);
224 return tiling->resolution(); 224 return tiling->resolution();
225 } 225 }
226 226
227 PictureLayerTiling* PictureLayerTilingSet::CoverageIterator::CurrentTiling() 227 PictureLayerTiling* PictureLayerTilingSet::CoverageIterator::CurrentTiling()
228 const { 228 const {
229 if (current_tiling_ < 0) 229 if (current_tiling_ < 0)
230 return NULL; 230 return nullptr;
231 if (static_cast<size_t>(current_tiling_) >= set_->tilings_.size()) 231 if (static_cast<size_t>(current_tiling_) >= set_->tilings_.size())
232 return NULL; 232 return nullptr;
233 return set_->tilings_[current_tiling_]; 233 return set_->tilings_[current_tiling_];
234 } 234 }
235 235
236 int PictureLayerTilingSet::CoverageIterator::NextTiling() const { 236 int PictureLayerTilingSet::CoverageIterator::NextTiling() const {
237 // Order returned by this method is: 237 // Order returned by this method is:
238 // 1. Ideal tiling index 238 // 1. Ideal tiling index
239 // 2. Tiling index < Ideal in decreasing order (higher res than ideal) 239 // 2. Tiling index < Ideal in decreasing order (higher res than ideal)
240 // 3. Tiling index > Ideal in increasing order (lower res than ideal) 240 // 3. Tiling index > Ideal in increasing order (lower res than ideal)
241 // 4. Tiling index > tilings.size() (invalid index) 241 // 4. Tiling index > tilings.size() (invalid index)
242 if (current_tiling_ < 0) 242 if (current_tiling_ < 0)
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 return low_res_range; 355 return low_res_range;
356 case LOWER_THAN_LOW_RES: 356 case LOWER_THAN_LOW_RES:
357 return TilingRange(low_res_range.end, tilings_.size()); 357 return TilingRange(low_res_range.end, tilings_.size());
358 } 358 }
359 359
360 NOTREACHED(); 360 NOTREACHED();
361 return TilingRange(0, 0); 361 return TilingRange(0, 0);
362 } 362 }
363 363
364 } // namespace cc 364 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698