Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/tiling_set_raster_queue_required.h" | 5 #include "cc/resources/tiling_set_raster_queue_required.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "cc/resources/picture_layer_tiling_set.h" | 9 #include "cc/resources/picture_layer_tiling_set.h" |
| 10 #include "cc/resources/tile.h" | 10 #include "cc/resources/tile.h" |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 // PictureLayerTiling::IsTileRequiredFor*, which all return false if the | 24 // PictureLayerTiling::IsTileRequiredFor*, which all return false if the |
| 25 // resolution is not HIGH_RESOLUTION. | 25 // resolution is not HIGH_RESOLUTION. |
| 26 PictureLayerTiling* tiling = | 26 PictureLayerTiling* tiling = |
| 27 tiling_set->FindTilingWithResolution(HIGH_RESOLUTION); | 27 tiling_set->FindTilingWithResolution(HIGH_RESOLUTION); |
| 28 // If we don't have a high res tiling, then this queue will yield no tiles. | 28 // If we don't have a high res tiling, then this queue will yield no tiles. |
| 29 // See PictureLayerImpl::CanHaveTilings for examples of when a HIGH_RESOLUTION | 29 // See PictureLayerImpl::CanHaveTilings for examples of when a HIGH_RESOLUTION |
| 30 // tiling would not be generated. | 30 // tiling would not be generated. |
| 31 if (!tiling) | 31 if (!tiling) |
| 32 return; | 32 return; |
| 33 | 33 |
| 34 iterator_ = TilingIterator(tiling, &tiling->tiling_data_); | 34 if (type == RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION && |
| 35 tiling->IsActiveTree()) { | |
|
enne (OOO)
2015/04/02 21:45:34
This is a bit weird. ActiveTiling knows it's acti
vmpstr
2015/04/02 22:33:27
I can reduce it to just an if based on type. For r
| |
| 36 iterator_ = TilingIterator(tiling, &tiling->tiling_data_, | |
| 37 tiling->pending_visible_rect()); | |
| 38 } else { | |
| 39 iterator_ = TilingIterator(tiling, &tiling->tiling_data_, | |
| 40 tiling->current_visible_rect()); | |
| 41 } | |
| 35 while (!iterator_.done() && !IsTileRequired(*iterator_)) | 42 while (!iterator_.done() && !IsTileRequired(*iterator_)) |
| 36 ++iterator_; | 43 ++iterator_; |
| 37 } | 44 } |
| 38 | 45 |
| 39 TilingSetRasterQueueRequired::~TilingSetRasterQueueRequired() { | 46 TilingSetRasterQueueRequired::~TilingSetRasterQueueRequired() { |
| 40 } | 47 } |
| 41 | 48 |
| 42 bool TilingSetRasterQueueRequired::IsEmpty() const { | 49 bool TilingSetRasterQueueRequired::IsEmpty() const { |
| 43 return iterator_.done(); | 50 return iterator_.done(); |
| 44 } | 51 } |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 66 (type_ == RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW && | 73 (type_ == RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW && |
| 67 tile->required_for_draw()); | 74 tile->required_for_draw()); |
| 68 } | 75 } |
| 69 | 76 |
| 70 TilingSetRasterQueueRequired::TilingIterator::TilingIterator() | 77 TilingSetRasterQueueRequired::TilingIterator::TilingIterator() |
| 71 : tiling_(nullptr), current_tile_(nullptr) { | 78 : tiling_(nullptr), current_tile_(nullptr) { |
| 72 } | 79 } |
| 73 | 80 |
| 74 TilingSetRasterQueueRequired::TilingIterator::TilingIterator( | 81 TilingSetRasterQueueRequired::TilingIterator::TilingIterator( |
| 75 PictureLayerTiling* tiling, | 82 PictureLayerTiling* tiling, |
| 76 TilingData* tiling_data) | 83 TilingData* tiling_data, |
| 84 const gfx::Rect& rect) | |
| 77 : tiling_(tiling), tiling_data_(tiling_data), current_tile_(nullptr) { | 85 : tiling_(tiling), tiling_data_(tiling_data), current_tile_(nullptr) { |
| 78 if (!tiling_->has_visible_rect_tiles()) { | |
| 79 // Verify that if we would create the iterator, then it would be empty (ie | |
| 80 // it would return false when evaluated as a bool). | |
| 81 DCHECK(!TilingData::Iterator(tiling_data_, tiling->current_visible_rect(), | |
| 82 false)); | |
| 83 return; | |
| 84 } | |
| 85 | |
| 86 visible_iterator_ = | 86 visible_iterator_ = |
| 87 TilingData::Iterator(tiling_data_, tiling_->current_visible_rect(), | 87 TilingData::Iterator(tiling_data_, rect, false /* include_borders */); |
| 88 false /* include_borders */); | |
| 89 if (!visible_iterator_) | 88 if (!visible_iterator_) |
| 90 return; | 89 return; |
| 91 | 90 |
| 92 current_tile_ = | 91 current_tile_ = |
| 93 tiling_->TileAt(visible_iterator_.index_x(), visible_iterator_.index_y()); | 92 tiling_->TileAt(visible_iterator_.index_x(), visible_iterator_.index_y()); |
| 94 | 93 |
| 95 // If this is a valid tile, return it. Note that we have to use a tiling check | 94 // If this is a valid tile, return it. Note that we have to use a tiling check |
| 96 // for occlusion, since the tile's internal state has not yet been updated. | 95 // for occlusion, since the tile's internal state has not yet been updated. |
| 97 if (current_tile_ && current_tile_->NeedsRaster() && | 96 if (current_tile_ && current_tile_->NeedsRaster() && |
| 98 !tiling_->IsTileOccluded(current_tile_)) { | 97 !tiling_->IsTileOccluded(current_tile_)) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 // in the NOW bin, which means that it can be required. | 131 // in the NOW bin, which means that it can be required. |
| 133 break; | 132 break; |
| 134 } | 133 } |
| 135 | 134 |
| 136 if (current_tile_) | 135 if (current_tile_) |
| 137 tiling_->UpdateTileAndTwinPriority(current_tile_); | 136 tiling_->UpdateTileAndTwinPriority(current_tile_); |
| 138 return *this; | 137 return *this; |
| 139 } | 138 } |
| 140 | 139 |
| 141 } // namespace cc | 140 } // namespace cc |
| OLD | NEW |