| 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/tiles/tiling_set_raster_queue_all.h" | 5 #include "cc/tiles/tiling_set_raster_queue_all.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "cc/tiles/picture_layer_tiling_set.h" | 9 #include "cc/tiles/picture_layer_tiling_set.h" |
| 10 #include "cc/tiles/tile.h" | 10 #include "cc/tiles/tile.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 TilingData* tiling_data, | 151 TilingData* tiling_data, |
| 152 PictureLayerTiling::PriorityRectType priority_rect_type) | 152 PictureLayerTiling::PriorityRectType priority_rect_type) |
| 153 : tiling_(tiling), | 153 : tiling_(tiling), |
| 154 tiling_data_(tiling_data), | 154 tiling_data_(tiling_data), |
| 155 priority_rect_type_(priority_rect_type) { | 155 priority_rect_type_(priority_rect_type) { |
| 156 } | 156 } |
| 157 | 157 |
| 158 template <typename TilingIteratorType> | 158 template <typename TilingIteratorType> |
| 159 void TilingSetRasterQueueAll::OnePriorityRectIterator::AdvanceToNextTile( | 159 void TilingSetRasterQueueAll::OnePriorityRectIterator::AdvanceToNextTile( |
| 160 TilingIteratorType* iterator) { | 160 TilingIteratorType* iterator) { |
| 161 bool found_tile = false; | 161 for (;;) { |
| 162 while (!found_tile) { | |
| 163 ++(*iterator); | 162 ++(*iterator); |
| 164 if (!(*iterator)) { | 163 if (!(*iterator)) { |
| 165 current_tile_ = PrioritizedTile(); | 164 current_tile_ = PrioritizedTile(); |
| 166 break; | 165 break; |
| 167 } | 166 } |
| 168 found_tile = GetFirstTileAndCheckIfValid(iterator); | 167 Tile* tile = tiling_->TileAt(iterator->index_x(), iterator->index_y()); |
| 168 if (IsTileValid(tile)) { |
| 169 tiling_->UpdateRequiredStatesOnTile(tile); |
| 170 current_tile_ = tiling_->MakePrioritizedTile(tile, priority_rect_type_); |
| 171 break; |
| 172 } |
| 169 } | 173 } |
| 170 } | 174 } |
| 171 | 175 |
| 172 template <typename TilingIteratorType> | 176 template <typename TilingIteratorType> |
| 173 bool TilingSetRasterQueueAll::OnePriorityRectIterator:: | 177 bool TilingSetRasterQueueAll::OnePriorityRectIterator:: |
| 174 GetFirstTileAndCheckIfValid(TilingIteratorType* iterator) { | 178 GetFirstTileAndCheckIfValid(TilingIteratorType* iterator) { |
| 175 Tile* tile = tiling_->TileAt(iterator->index_x(), iterator->index_y()); | 179 Tile* tile = tiling_->TileAt(iterator->index_x(), iterator->index_y()); |
| 176 if (!tile || !TileNeedsRaster(tile)) { | 180 if (!IsTileValid(tile)) { |
| 177 current_tile_ = PrioritizedTile(); | |
| 178 return false; | |
| 179 } | |
| 180 // After the pending visible rect has been processed, we must return false | |
| 181 // for pending visible rect tiles as tiling iterators do not ignore those | |
| 182 // tiles. | |
| 183 if (priority_rect_type_ > PictureLayerTiling::PENDING_VISIBLE_RECT && | |
| 184 tiling_->pending_visible_rect().Intersects(tile->content_rect())) { | |
| 185 current_tile_ = PrioritizedTile(); | 181 current_tile_ = PrioritizedTile(); |
| 186 return false; | 182 return false; |
| 187 } | 183 } |
| 188 tiling_->UpdateRequiredStatesOnTile(tile); | 184 tiling_->UpdateRequiredStatesOnTile(tile); |
| 189 current_tile_ = tiling_->MakePrioritizedTile(tile, priority_rect_type_); | 185 current_tile_ = tiling_->MakePrioritizedTile(tile, priority_rect_type_); |
| 190 return true; | 186 return true; |
| 191 } | 187 } |
| 192 | 188 |
| 189 bool TilingSetRasterQueueAll::OnePriorityRectIterator::IsTileValid( |
| 190 const Tile* tile) const { |
| 191 if (!tile || !TileNeedsRaster(tile)) |
| 192 return false; |
| 193 // After the pending visible rect has been processed, we must return false |
| 194 // for pending visible rect tiles as tiling iterators do not ignore those |
| 195 // tiles. |
| 196 if (priority_rect_type_ > PictureLayerTiling::PENDING_VISIBLE_RECT && |
| 197 tiling_->pending_visible_rect().Intersects(tile->content_rect())) { |
| 198 return false; |
| 199 } |
| 200 return true; |
| 201 } |
| 202 |
| 193 // VisibleTilingIterator. | 203 // VisibleTilingIterator. |
| 194 TilingSetRasterQueueAll::VisibleTilingIterator::VisibleTilingIterator( | 204 TilingSetRasterQueueAll::VisibleTilingIterator::VisibleTilingIterator( |
| 195 PictureLayerTiling* tiling, | 205 PictureLayerTiling* tiling, |
| 196 TilingData* tiling_data) | 206 TilingData* tiling_data) |
| 197 : OnePriorityRectIterator(tiling, | 207 : OnePriorityRectIterator(tiling, |
| 198 tiling_data, | 208 tiling_data, |
| 199 PictureLayerTiling::VISIBLE_RECT) { | 209 PictureLayerTiling::VISIBLE_RECT) { |
| 200 if (!tiling_->has_visible_rect_tiles()) | 210 if (!tiling_->has_visible_rect_tiles()) |
| 201 return; | 211 return; |
| 202 iterator_ = | 212 iterator_ = |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 current_tile_ = PrioritizedTile(); | 461 current_tile_ = PrioritizedTile(); |
| 452 return *this; | 462 return *this; |
| 453 } | 463 } |
| 454 current_tile_ = *eventually_iterator_; | 464 current_tile_ = *eventually_iterator_; |
| 455 break; | 465 break; |
| 456 } | 466 } |
| 457 return *this; | 467 return *this; |
| 458 } | 468 } |
| 459 | 469 |
| 460 } // namespace cc | 470 } // namespace cc |
| OLD | NEW |