| 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 #ifndef CC_RESOURCES_TILING_SET_RASTER_QUEUE_H_ | 5 #ifndef CC_RESOURCES_TILING_SET_RASTER_QUEUE_H_ |
| 6 #define CC_RESOURCES_TILING_SET_RASTER_QUEUE_H_ | 6 #define CC_RESOURCES_TILING_SET_RASTER_QUEUE_H_ |
| 7 | 7 |
| 8 #include "cc/base/cc_export.h" | 8 #include "cc/base/cc_export.h" |
| 9 #include "cc/resources/picture_layer_tiling_set.h" | 9 #include "cc/resources/picture_layer_tiling_set.h" |
| 10 #include "cc/resources/tile.h" |
| 11 #include "cc/resources/tile_priority.h" |
| 10 | 12 |
| 11 namespace cc { | 13 namespace cc { |
| 12 | 14 |
| 13 class CC_EXPORT TilingSetRasterQueue { | 15 class CC_EXPORT TilingSetRasterQueue { |
| 14 public: | 16 public: |
| 15 TilingSetRasterQueue(); | 17 TilingSetRasterQueue(); |
| 16 TilingSetRasterQueue(PictureLayerTilingSet* tiling_set, | 18 TilingSetRasterQueue(PictureLayerTilingSet* tiling_set, |
| 17 bool prioritize_low_res); | 19 bool prioritize_low_res); |
| 18 ~TilingSetRasterQueue(); | 20 ~TilingSetRasterQueue(); |
| 19 | 21 |
| 20 Tile* Top(); | 22 Tile* Top(); |
| 21 const Tile* Top() const; | 23 const Tile* Top() const; |
| 22 void Pop(); | 24 void Pop(); |
| 23 bool IsEmpty() const; | 25 bool IsEmpty() const; |
| 24 | 26 |
| 25 private: | 27 private: |
| 28 class TilingIterator { |
| 29 public: |
| 30 TilingIterator(); |
| 31 explicit TilingIterator(PictureLayerTiling* tiling, |
| 32 TilingData* tiling_data); |
| 33 ~TilingIterator(); |
| 34 |
| 35 operator bool() const { return !!current_tile_; } |
| 36 const Tile* operator*() const { return current_tile_; } |
| 37 Tile* operator*() { return current_tile_; } |
| 38 TilePriority::PriorityBin type() const { |
| 39 switch (phase_) { |
| 40 case VISIBLE_RECT: |
| 41 return TilePriority::NOW; |
| 42 case SKEWPORT_RECT: |
| 43 case SOON_BORDER_RECT: |
| 44 return TilePriority::SOON; |
| 45 case EVENTUALLY_RECT: |
| 46 return TilePriority::EVENTUALLY; |
| 47 } |
| 48 NOTREACHED(); |
| 49 return TilePriority::EVENTUALLY; |
| 50 } |
| 51 |
| 52 TilingIterator& operator++(); |
| 53 |
| 54 private: |
| 55 enum Phase { |
| 56 VISIBLE_RECT, |
| 57 SKEWPORT_RECT, |
| 58 SOON_BORDER_RECT, |
| 59 EVENTUALLY_RECT |
| 60 }; |
| 61 |
| 62 void AdvancePhase(); |
| 63 bool TileNeedsRaster(Tile* tile) const { |
| 64 return tile->NeedsRaster() && !tiling_->IsTileOccluded(tile); |
| 65 } |
| 66 |
| 67 PictureLayerTiling* tiling_; |
| 68 TilingData* tiling_data_; |
| 69 |
| 70 Phase phase_; |
| 71 |
| 72 Tile* current_tile_; |
| 73 TilingData::Iterator visible_iterator_; |
| 74 TilingData::SpiralDifferenceIterator spiral_iterator_; |
| 75 }; |
| 76 |
| 26 enum IteratorType { LOW_RES, HIGH_RES, NUM_ITERATORS }; | 77 enum IteratorType { LOW_RES, HIGH_RES, NUM_ITERATORS }; |
| 27 | 78 |
| 28 void AdvanceToNextStage(); | 79 void AdvanceToNextStage(); |
| 29 | 80 |
| 30 PictureLayerTilingSet* tiling_set_; | 81 PictureLayerTilingSet* tiling_set_; |
| 31 | 82 |
| 32 struct IterationStage { | 83 struct IterationStage { |
| 33 IteratorType iterator_type; | 84 IteratorType iterator_type; |
| 34 TilePriority::PriorityBin tile_type; | 85 TilePriority::PriorityBin tile_type; |
| 35 }; | 86 }; |
| 36 | 87 |
| 37 size_t current_stage_; | 88 size_t current_stage_; |
| 38 | 89 |
| 39 // One low res stage, and three high res stages. | 90 // One low res stage, and three high res stages. |
| 40 IterationStage stages_[4]; | 91 IterationStage stages_[4]; |
| 41 PictureLayerTiling::TilingRasterTileIterator iterators_[NUM_ITERATORS]; | 92 TilingIterator iterators_[NUM_ITERATORS]; |
| 42 }; | 93 }; |
| 43 | 94 |
| 44 } // namespace cc | 95 } // namespace cc |
| 45 | 96 |
| 46 #endif // CC_RESOURCES_TILING_SET_RASTER_QUEUE_H_ | 97 #endif // CC_RESOURCES_TILING_SET_RASTER_QUEUE_H_ |
| OLD | NEW |