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_ALL_H_ | 5 #ifndef CC_RESOURCES_TILING_SET_RASTER_QUEUE_ALL_H_ |
6 #define CC_RESOURCES_TILING_SET_RASTER_QUEUE_ALL_H_ | 6 #define CC_RESOURCES_TILING_SET_RASTER_QUEUE_ALL_H_ |
7 | 7 |
8 #include "base/containers/stack_container.h" | 8 #include "base/containers/stack_container.h" |
9 #include "cc/base/cc_export.h" | 9 #include "cc/base/cc_export.h" |
10 #include "cc/resources/picture_layer_tiling_set.h" | 10 #include "cc/resources/picture_layer_tiling_set.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 const PrioritizedTile& Top() const; | 25 const PrioritizedTile& Top() const; |
26 void Pop(); | 26 void Pop(); |
27 bool IsEmpty() const; | 27 bool IsEmpty() const; |
28 | 28 |
29 private: | 29 private: |
30 // Helper base class for individual region iterators. | 30 // Helper base class for individual region iterators. |
31 class OnePriorityRectIterator { | 31 class OnePriorityRectIterator { |
32 public: | 32 public: |
33 OnePriorityRectIterator(); | 33 OnePriorityRectIterator(); |
34 OnePriorityRectIterator(PictureLayerTiling* tiling, | 34 OnePriorityRectIterator( |
35 TilingData* tiling_data); | 35 PictureLayerTiling* tiling, |
| 36 TilingData* tiling_data, |
| 37 PictureLayerTiling::PriorityRectType priority_rect_type); |
36 | 38 |
37 bool done() const { return !current_tile_.tile(); } | 39 bool done() const { return !current_tile_.tile(); } |
38 const PrioritizedTile& operator*() const { return current_tile_; } | 40 const PrioritizedTile& operator*() const { return current_tile_; } |
39 | 41 |
40 protected: | 42 protected: |
41 ~OnePriorityRectIterator() = default; | 43 ~OnePriorityRectIterator() = default; |
42 bool TileNeedsRaster(Tile* tile) const { | 44 bool TileNeedsRaster(Tile* tile) const { |
43 return tile->NeedsRaster() && !tiling_->IsTileOccluded(tile); | 45 return tile->NeedsRaster() && !tiling_->IsTileOccluded(tile); |
44 } | 46 } |
45 | 47 |
46 template <typename TilingIteratorType> | 48 template <typename TilingIteratorType> |
47 void AdvanceToNextTile(TilingIteratorType* iterator); | 49 void AdvanceToNextTile(TilingIteratorType* iterator); |
48 template <typename TilingIteratorType> | 50 template <typename TilingIteratorType> |
49 bool GetFirstTileAndCheckIfValid(TilingIteratorType* iterator); | 51 bool GetFirstTileAndCheckIfValid(TilingIteratorType* iterator); |
50 | 52 |
51 PrioritizedTile current_tile_; | 53 PrioritizedTile current_tile_; |
52 PictureLayerTiling* tiling_; | 54 PictureLayerTiling* tiling_; |
53 TilingData* tiling_data_; | 55 TilingData* tiling_data_; |
| 56 PictureLayerTiling::PriorityRectType priority_rect_type_; |
54 }; | 57 }; |
55 | 58 |
56 // Iterates over visible rect only, left to right top to bottom order. | 59 // Iterates over visible rect only, left to right top to bottom order. |
57 class VisibleTilingIterator : public OnePriorityRectIterator { | 60 class VisibleTilingIterator : public OnePriorityRectIterator { |
58 public: | 61 public: |
59 VisibleTilingIterator() = default; | 62 VisibleTilingIterator() = default; |
60 VisibleTilingIterator(PictureLayerTiling* tiling, TilingData* tiling_data); | 63 VisibleTilingIterator(PictureLayerTiling* tiling, TilingData* tiling_data); |
61 | 64 |
62 VisibleTilingIterator& operator++(); | 65 VisibleTilingIterator& operator++(); |
63 | 66 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 public: | 127 public: |
125 TilingIterator(); | 128 TilingIterator(); |
126 explicit TilingIterator(PictureLayerTiling* tiling, | 129 explicit TilingIterator(PictureLayerTiling* tiling, |
127 TilingData* tiling_data); | 130 TilingData* tiling_data); |
128 ~TilingIterator(); | 131 ~TilingIterator(); |
129 | 132 |
130 bool done() const { return !current_tile_.tile(); } | 133 bool done() const { return !current_tile_.tile(); } |
131 const PrioritizedTile& operator*() const { return current_tile_; } | 134 const PrioritizedTile& operator*() const { return current_tile_; } |
132 TilePriority::PriorityBin type() const { | 135 TilePriority::PriorityBin type() const { |
133 switch (phase_) { | 136 switch (phase_) { |
134 case VISIBLE_RECT: | 137 case Phase::VISIBLE_RECT: |
135 return TilePriority::NOW; | 138 return TilePriority::NOW; |
136 case PENDING_VISIBLE_RECT: | 139 case Phase::PENDING_VISIBLE_RECT: |
137 case SKEWPORT_RECT: | 140 case Phase::SKEWPORT_RECT: |
138 case SOON_BORDER_RECT: | 141 case Phase::SOON_BORDER_RECT: |
139 return TilePriority::SOON; | 142 return TilePriority::SOON; |
140 case EVENTUALLY_RECT: | 143 case Phase::EVENTUALLY_RECT: |
141 return TilePriority::EVENTUALLY; | 144 return TilePriority::EVENTUALLY; |
142 } | 145 } |
143 NOTREACHED(); | 146 NOTREACHED(); |
144 return TilePriority::EVENTUALLY; | 147 return TilePriority::EVENTUALLY; |
145 } | 148 } |
146 | 149 |
147 TilingIterator& operator++(); | 150 TilingIterator& operator++(); |
148 | 151 |
149 private: | 152 private: |
150 // PENDING VISIBLE RECT refers to the visible rect that will become current | 153 using Phase = PictureLayerTiling::PriorityRectType; |
151 // upon activation (ie, the pending tree's visible rect). Tiles in this | |
152 // region that are not part of the current visible rect are all handled | |
153 // here. Note that when processing a pending tree, this rect is the same as | |
154 // the visible rect so no tiles are processed in this case. | |
155 enum Phase { | |
156 VISIBLE_RECT, | |
157 PENDING_VISIBLE_RECT, | |
158 SKEWPORT_RECT, | |
159 SOON_BORDER_RECT, | |
160 EVENTUALLY_RECT | |
161 }; | |
162 | 154 |
163 void AdvancePhase(); | 155 void AdvancePhase(); |
164 | 156 |
165 PictureLayerTiling* tiling_; | 157 PictureLayerTiling* tiling_; |
166 TilingData* tiling_data_; | 158 TilingData* tiling_data_; |
167 | 159 |
168 Phase phase_; | 160 Phase phase_; |
169 | 161 |
170 PrioritizedTile current_tile_; | 162 PrioritizedTile current_tile_; |
171 VisibleTilingIterator visible_iterator_; | 163 VisibleTilingIterator visible_iterator_; |
(...skipping 26 matching lines...) Expand all Loading... |
198 // ideal pending high res. | 190 // ideal pending high res. |
199 base::StackVector<IterationStage, 6> stages_; | 191 base::StackVector<IterationStage, 6> stages_; |
200 TilingIterator iterators_[NUM_ITERATORS]; | 192 TilingIterator iterators_[NUM_ITERATORS]; |
201 | 193 |
202 DISALLOW_COPY_AND_ASSIGN(TilingSetRasterQueueAll); | 194 DISALLOW_COPY_AND_ASSIGN(TilingSetRasterQueueAll); |
203 }; | 195 }; |
204 | 196 |
205 } // namespace cc | 197 } // namespace cc |
206 | 198 |
207 #endif // CC_RESOURCES_TILING_SET_RASTER_QUEUE_ALL_H_ | 199 #endif // CC_RESOURCES_TILING_SET_RASTER_QUEUE_ALL_H_ |
OLD | NEW |