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_TILES_TILING_SET_RASTER_QUEUE_ALL_H_ | 5 #ifndef CC_TILES_TILING_SET_RASTER_QUEUE_ALL_H_ |
6 #define CC_TILES_TILING_SET_RASTER_QUEUE_ALL_H_ | 6 #define CC_TILES_TILING_SET_RASTER_QUEUE_ALL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/containers/stack_container.h" | 10 #include "base/containers/stack_container.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 private: | 32 private: |
33 // Helper base class for individual region iterators. | 33 // Helper base class for individual region iterators. |
34 class OnePriorityRectIterator { | 34 class OnePriorityRectIterator { |
35 public: | 35 public: |
36 OnePriorityRectIterator(); | 36 OnePriorityRectIterator(); |
37 OnePriorityRectIterator( | 37 OnePriorityRectIterator( |
38 PictureLayerTiling* tiling, | 38 PictureLayerTiling* tiling, |
39 TilingData* tiling_data, | 39 TilingData* tiling_data, |
40 PictureLayerTiling::PriorityRectType priority_rect_type); | 40 PictureLayerTiling::PriorityRectType priority_rect_type); |
| 41 OnePriorityRectIterator(const OnePriorityRectIterator& other) = default; |
| 42 OnePriorityRectIterator(OnePriorityRectIterator&& other) = default; |
| 43 |
| 44 OnePriorityRectIterator& operator=(const OnePriorityRectIterator& other) = |
| 45 default; |
| 46 OnePriorityRectIterator& operator=(OnePriorityRectIterator&& other) = |
| 47 default; |
41 | 48 |
42 bool done() const { return !current_tile_.tile(); } | 49 bool done() const { return !current_tile_.tile(); } |
43 const PrioritizedTile& operator*() const { return current_tile_; } | 50 const PrioritizedTile& operator*() const { return current_tile_; } |
44 | 51 |
45 protected: | 52 protected: |
46 ~OnePriorityRectIterator() = default; | 53 ~OnePriorityRectIterator() = default; |
47 bool TileNeedsRaster(const Tile* tile) const { | 54 bool TileNeedsRaster(const Tile* tile) const { |
48 return tile->draw_info().NeedsRaster() && !tiling_->IsTileOccluded(tile); | 55 return tile->draw_info().NeedsRaster() && !tiling_->IsTileOccluded(tile); |
49 } | 56 } |
50 | 57 |
51 template <typename TilingIteratorType> | 58 template <typename TilingIteratorType> |
52 void AdvanceToNextTile(TilingIteratorType* iterator); | 59 void AdvanceToNextTile(TilingIteratorType* iterator); |
53 template <typename TilingIteratorType> | 60 template <typename TilingIteratorType> |
54 bool GetFirstTileAndCheckIfValid(TilingIteratorType* iterator); | 61 bool GetFirstTileAndCheckIfValid(TilingIteratorType* iterator); |
55 bool IsTileValid(const Tile* tile) const; | 62 bool IsTileValid(const Tile* tile) const; |
56 | 63 |
57 PrioritizedTile current_tile_; | 64 PrioritizedTile current_tile_; |
58 PictureLayerTiling* tiling_; | 65 PictureLayerTiling* tiling_; |
59 TilingData* tiling_data_; | 66 TilingData* tiling_data_; |
60 PictureLayerTiling::PriorityRectType priority_rect_type_; | 67 PictureLayerTiling::PriorityRectType priority_rect_type_; |
61 gfx::Rect pending_visible_rect_; | 68 gfx::Rect pending_visible_rect_; |
62 }; | 69 }; |
63 | 70 |
64 // Iterates over visible rect only, left to right top to bottom order. | 71 // Iterates over visible rect only, left to right top to bottom order. |
65 class VisibleTilingIterator : public OnePriorityRectIterator { | 72 class VisibleTilingIterator : public OnePriorityRectIterator { |
66 public: | 73 public: |
67 VisibleTilingIterator() = default; | 74 VisibleTilingIterator() = default; |
68 VisibleTilingIterator(PictureLayerTiling* tiling, TilingData* tiling_data); | 75 VisibleTilingIterator(PictureLayerTiling* tiling, TilingData* tiling_data); |
| 76 VisibleTilingIterator(const VisibleTilingIterator& other) = default; |
| 77 VisibleTilingIterator(VisibleTilingIterator&& other) = default; |
| 78 |
| 79 VisibleTilingIterator& operator=(const VisibleTilingIterator& other) = |
| 80 default; |
| 81 VisibleTilingIterator& operator=(VisibleTilingIterator&& other) = default; |
69 | 82 |
70 VisibleTilingIterator& operator++(); | 83 VisibleTilingIterator& operator++(); |
71 | 84 |
72 private: | 85 private: |
73 TilingData::Iterator iterator_; | 86 TilingData::Iterator iterator_; |
74 }; | 87 }; |
75 | 88 |
76 class PendingVisibleTilingIterator : public OnePriorityRectIterator { | 89 class PendingVisibleTilingIterator : public OnePriorityRectIterator { |
77 public: | 90 public: |
78 PendingVisibleTilingIterator() = default; | 91 PendingVisibleTilingIterator() = default; |
79 PendingVisibleTilingIterator(PictureLayerTiling* tiling, | 92 PendingVisibleTilingIterator(PictureLayerTiling* tiling, |
80 TilingData* tiling_data); | 93 TilingData* tiling_data); |
| 94 PendingVisibleTilingIterator(const PendingVisibleTilingIterator& other) = |
| 95 default; |
| 96 PendingVisibleTilingIterator(PendingVisibleTilingIterator&& other) = |
| 97 default; |
| 98 |
| 99 PendingVisibleTilingIterator& operator=( |
| 100 const PendingVisibleTilingIterator& other) = default; |
| 101 PendingVisibleTilingIterator& operator=( |
| 102 PendingVisibleTilingIterator&& other) = default; |
81 | 103 |
82 PendingVisibleTilingIterator& operator++(); | 104 PendingVisibleTilingIterator& operator++(); |
83 | 105 |
84 private: | 106 private: |
85 TilingData::DifferenceIterator iterator_; | 107 TilingData::DifferenceIterator iterator_; |
86 }; | 108 }; |
87 | 109 |
88 // Iterates over skewport only, spiral around the visible rect. | 110 // Iterates over skewport only, spiral around the visible rect. |
89 class SkewportTilingIterator : public OnePriorityRectIterator { | 111 class SkewportTilingIterator : public OnePriorityRectIterator { |
90 public: | 112 public: |
91 SkewportTilingIterator() = default; | 113 SkewportTilingIterator() = default; |
92 SkewportTilingIterator(PictureLayerTiling* tiling, TilingData* tiling_data); | 114 SkewportTilingIterator(PictureLayerTiling* tiling, TilingData* tiling_data); |
| 115 SkewportTilingIterator(const SkewportTilingIterator& other) = default; |
| 116 SkewportTilingIterator(SkewportTilingIterator&& other) = default; |
| 117 |
| 118 SkewportTilingIterator& operator=(const SkewportTilingIterator& other) = |
| 119 default; |
| 120 SkewportTilingIterator& operator=(SkewportTilingIterator&& other) = default; |
93 | 121 |
94 SkewportTilingIterator& operator++(); | 122 SkewportTilingIterator& operator++(); |
95 | 123 |
96 private: | 124 private: |
97 TilingData::SpiralDifferenceIterator iterator_; | 125 TilingData::SpiralDifferenceIterator iterator_; |
98 }; | 126 }; |
99 | 127 |
100 // Iterates over soon border only, spiral around the visible rect. | 128 // Iterates over soon border only, spiral around the visible rect. |
101 class SoonBorderTilingIterator : public OnePriorityRectIterator { | 129 class SoonBorderTilingIterator : public OnePriorityRectIterator { |
102 public: | 130 public: |
103 SoonBorderTilingIterator() = default; | 131 SoonBorderTilingIterator() = default; |
104 SoonBorderTilingIterator(PictureLayerTiling* tiling, | 132 SoonBorderTilingIterator(PictureLayerTiling* tiling, |
105 TilingData* tiling_data); | 133 TilingData* tiling_data); |
| 134 SoonBorderTilingIterator(const SoonBorderTilingIterator& other) = default; |
| 135 SoonBorderTilingIterator(SoonBorderTilingIterator&& other) = default; |
| 136 |
| 137 SoonBorderTilingIterator& operator=(const SoonBorderTilingIterator& other) = |
| 138 default; |
| 139 SoonBorderTilingIterator& operator=(SoonBorderTilingIterator&& other) = |
| 140 default; |
106 | 141 |
107 SoonBorderTilingIterator& operator++(); | 142 SoonBorderTilingIterator& operator++(); |
108 | 143 |
109 private: | 144 private: |
110 TilingData::SpiralDifferenceIterator iterator_; | 145 TilingData::SpiralDifferenceIterator iterator_; |
111 }; | 146 }; |
112 | 147 |
113 // Iterates over eventually rect only, spiral around the soon rect. | 148 // Iterates over eventually rect only, spiral around the soon rect. |
114 class EventuallyTilingIterator : public OnePriorityRectIterator { | 149 class EventuallyTilingIterator : public OnePriorityRectIterator { |
115 public: | 150 public: |
116 EventuallyTilingIterator() = default; | 151 EventuallyTilingIterator() = default; |
117 EventuallyTilingIterator(PictureLayerTiling* tiling, | 152 EventuallyTilingIterator(PictureLayerTiling* tiling, |
118 TilingData* tiling_data); | 153 TilingData* tiling_data); |
| 154 EventuallyTilingIterator(const EventuallyTilingIterator& other) = default; |
| 155 EventuallyTilingIterator(EventuallyTilingIterator&& other) = default; |
| 156 |
| 157 EventuallyTilingIterator& operator=(const EventuallyTilingIterator& other) = |
| 158 default; |
| 159 EventuallyTilingIterator& operator=(EventuallyTilingIterator&& other) = |
| 160 default; |
119 | 161 |
120 EventuallyTilingIterator& operator++(); | 162 EventuallyTilingIterator& operator++(); |
121 | 163 |
122 private: | 164 private: |
123 TilingData::SpiralDifferenceIterator iterator_; | 165 TilingData::SpiralDifferenceIterator iterator_; |
124 }; | 166 }; |
125 | 167 |
126 // Iterates over all of the above phases in the following order: visible, | 168 // Iterates over all of the above phases in the following order: visible, |
127 // skewport, soon border, eventually. | 169 // skewport, soon border, eventually. |
128 class TilingIterator { | 170 class TilingIterator { |
129 public: | 171 public: |
130 TilingIterator(); | 172 TilingIterator(); |
131 explicit TilingIterator(PictureLayerTiling* tiling, | 173 explicit TilingIterator(PictureLayerTiling* tiling, |
132 TilingData* tiling_data); | 174 TilingData* tiling_data); |
| 175 TilingIterator(const TilingIterator& other); |
| 176 TilingIterator(TilingIterator&& other); |
133 ~TilingIterator(); | 177 ~TilingIterator(); |
134 | 178 |
| 179 TilingIterator& operator=(const TilingIterator& other); |
| 180 TilingIterator& operator=(TilingIterator&& other); |
| 181 |
135 bool done() const { return !current_tile_.tile(); } | 182 bool done() const { return !current_tile_.tile(); } |
136 const PrioritizedTile& operator*() const { return current_tile_; } | 183 const PrioritizedTile& operator*() const { return current_tile_; } |
137 TilePriority::PriorityBin type() const { | 184 TilePriority::PriorityBin type() const { |
138 switch (phase_) { | 185 switch (phase_) { |
139 case Phase::VISIBLE_RECT: | 186 case Phase::VISIBLE_RECT: |
140 return TilePriority::NOW; | 187 return TilePriority::NOW; |
141 case Phase::PENDING_VISIBLE_RECT: | 188 case Phase::PENDING_VISIBLE_RECT: |
142 case Phase::SKEWPORT_RECT: | 189 case Phase::SKEWPORT_RECT: |
143 case Phase::SOON_BORDER_RECT: | 190 case Phase::SOON_BORDER_RECT: |
144 return TilePriority::SOON; | 191 return TilePriority::SOON; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 // ideal pending high res. | 240 // ideal pending high res. |
194 base::StackVector<IterationStage, 6> stages_; | 241 base::StackVector<IterationStage, 6> stages_; |
195 TilingIterator iterators_[NUM_ITERATORS]; | 242 TilingIterator iterators_[NUM_ITERATORS]; |
196 | 243 |
197 DISALLOW_COPY_AND_ASSIGN(TilingSetRasterQueueAll); | 244 DISALLOW_COPY_AND_ASSIGN(TilingSetRasterQueueAll); |
198 }; | 245 }; |
199 | 246 |
200 } // namespace cc | 247 } // namespace cc |
201 | 248 |
202 #endif // CC_TILES_TILING_SET_RASTER_QUEUE_ALL_H_ | 249 #endif // CC_TILES_TILING_SET_RASTER_QUEUE_ALL_H_ |
OLD | NEW |