Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 return NULL; | 211 return NULL; |
| 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 NULL; |
| 218 return *tiling_iter_; | 218 return *tiling_iter_; |
| 219 } | 219 } |
| 220 | 220 |
| 221 PictureLayerTiling* PictureLayerTilingSet::CoverageIterator::CurrentTiling() { | 221 TileResolution PictureLayerTilingSet::CoverageIterator::resolution() const { |
| 222 const PictureLayerTiling* tiling = CurrentTiling(); | |
| 223 if (tiling) | |
|
danakj
2014/10/08 18:46:26
this is a case of doing if() for something you als
vmpstr
2014/10/08 22:38:34
Done.
| |
| 224 return tiling->resolution(); | |
| 225 NOTREACHED(); | |
| 226 return NON_IDEAL_RESOLUTION; | |
| 227 } | |
| 228 | |
| 229 PictureLayerTiling* PictureLayerTilingSet::CoverageIterator::CurrentTiling() | |
| 230 const { | |
| 222 if (current_tiling_ < 0) | 231 if (current_tiling_ < 0) |
| 223 return NULL; | 232 return NULL; |
| 224 if (static_cast<size_t>(current_tiling_) >= set_->tilings_.size()) | 233 if (static_cast<size_t>(current_tiling_) >= set_->tilings_.size()) |
| 225 return NULL; | 234 return NULL; |
| 226 return set_->tilings_[current_tiling_]; | 235 return set_->tilings_[current_tiling_]; |
| 227 } | 236 } |
| 228 | 237 |
| 229 int PictureLayerTilingSet::CoverageIterator::NextTiling() const { | 238 int PictureLayerTilingSet::CoverageIterator::NextTiling() const { |
| 230 // Order returned by this method is: | 239 // Order returned by this method is: |
| 231 // 1. Ideal tiling index | 240 // 1. Ideal tiling index |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 300 } | 309 } |
| 301 | 310 |
| 302 return *this; | 311 return *this; |
| 303 } | 312 } |
| 304 | 313 |
| 305 PictureLayerTilingSet::CoverageIterator::operator bool() const { | 314 PictureLayerTilingSet::CoverageIterator::operator bool() const { |
| 306 return current_tiling_ < static_cast<int>(set_->tilings_.size()) || | 315 return current_tiling_ < static_cast<int>(set_->tilings_.size()) || |
| 307 region_iter_.has_rect(); | 316 region_iter_.has_rect(); |
| 308 } | 317 } |
| 309 | 318 |
| 310 void PictureLayerTilingSet::DidBecomeActive() { | |
| 311 for (size_t i = 0; i < tilings_.size(); ++i) | |
| 312 tilings_[i]->DidBecomeActive(); | |
| 313 } | |
| 314 | |
| 315 void PictureLayerTilingSet::DidBecomeRecycled() { | |
| 316 for (size_t i = 0; i < tilings_.size(); ++i) | |
| 317 tilings_[i]->DidBecomeRecycled(); | |
| 318 } | |
| 319 | |
| 320 void PictureLayerTilingSet::AsValueInto(base::debug::TracedValue* state) const { | 319 void PictureLayerTilingSet::AsValueInto(base::debug::TracedValue* state) const { |
| 321 for (size_t i = 0; i < tilings_.size(); ++i) { | 320 for (size_t i = 0; i < tilings_.size(); ++i) { |
| 322 state->BeginDictionary(); | 321 state->BeginDictionary(); |
| 323 tilings_[i]->AsValueInto(state); | 322 tilings_[i]->AsValueInto(state); |
| 324 state->EndDictionary(); | 323 state->EndDictionary(); |
| 325 } | 324 } |
| 326 } | 325 } |
| 327 | 326 |
| 328 size_t PictureLayerTilingSet::GPUMemoryUsageInBytes() const { | 327 size_t PictureLayerTilingSet::GPUMemoryUsageInBytes() const { |
| 329 size_t amount = 0; | 328 size_t amount = 0; |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 358 return low_res_range; | 357 return low_res_range; |
| 359 case LOWER_THAN_LOW_RES: | 358 case LOWER_THAN_LOW_RES: |
| 360 return TilingRange(low_res_range.end, tilings_.size()); | 359 return TilingRange(low_res_range.end, tilings_.size()); |
| 361 } | 360 } |
| 362 | 361 |
| 363 NOTREACHED(); | 362 NOTREACHED(); |
| 364 return TilingRange(0, 0); | 363 return TilingRange(0, 0); |
| 365 } | 364 } |
| 366 | 365 |
| 367 } // namespace cc | 366 } // namespace cc |
| OLD | NEW |