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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 if (!visible_iterator_) | 101 if (!visible_iterator_) |
102 return; | 102 return; |
103 | 103 |
104 current_tile_ = | 104 current_tile_ = |
105 tiling_->TileAt(visible_iterator_.index_x(), visible_iterator_.index_y()); | 105 tiling_->TileAt(visible_iterator_.index_x(), visible_iterator_.index_y()); |
106 | 106 |
107 // If this is a valid tile, return it. Note that we have to use a tiling check | 107 // If this is a valid tile, return it. Note that we have to use a tiling check |
108 // for occlusion, since the tile's internal state has not yet been updated. | 108 // for occlusion, since the tile's internal state has not yet been updated. |
109 if (current_tile_ && current_tile_->NeedsRaster() && | 109 if (current_tile_ && current_tile_->NeedsRaster() && |
110 !tiling_->IsTileOccluded(current_tile_)) { | 110 !tiling_->IsTileOccluded(current_tile_)) { |
111 tiling_->UpdateTileAndTwinPriority(current_tile_); | 111 tiling_->UpdateTilePriority(current_tile_); |
112 return; | 112 return; |
113 } | 113 } |
114 ++(*this); | 114 ++(*this); |
115 } | 115 } |
116 | 116 |
117 TilingSetRasterQueueRequired::TilingIterator::~TilingIterator() { | 117 TilingSetRasterQueueRequired::TilingIterator::~TilingIterator() { |
118 } | 118 } |
119 | 119 |
120 TilingSetRasterQueueRequired::TilingIterator& | 120 TilingSetRasterQueueRequired::TilingIterator& |
121 TilingSetRasterQueueRequired::TilingIterator:: | 121 TilingSetRasterQueueRequired::TilingIterator:: |
122 operator++() { | 122 operator++() { |
123 while (true) { | 123 while (true) { |
124 ++visible_iterator_; | 124 ++visible_iterator_; |
125 if (!visible_iterator_) { | 125 if (!visible_iterator_) { |
126 current_tile_ = nullptr; | 126 current_tile_ = nullptr; |
127 return *this; | 127 return *this; |
128 } | 128 } |
129 std::pair<int, int> next_index = visible_iterator_.index(); | 129 std::pair<int, int> next_index = visible_iterator_.index(); |
130 current_tile_ = tiling_->TileAt(next_index.first, next_index.second); | 130 current_tile_ = tiling_->TileAt(next_index.first, next_index.second); |
131 // If the tile doesn't exist or if it exists but doesn't need raster work, | 131 // If the tile doesn't exist or if it exists but doesn't need raster work, |
132 // we can move on to the next tile. | 132 // we can move on to the next tile. |
133 if (!current_tile_ || !current_tile_->NeedsRaster()) | 133 if (!current_tile_ || !current_tile_->NeedsRaster()) |
134 continue; | 134 continue; |
135 | 135 |
136 // If the tile is occluded, we also can skip it. Note that we use the tiling | 136 // If the tile is occluded, we also can skip it. Note that we use the tiling |
137 // check for occlusion, since tile's internal state has not yet been updated | 137 // check for occlusion, since tile's internal state has not yet been updated |
138 // (by UpdateTileAndTwinPriority). The tiling check does not rely on tile's | 138 // (by UpdateTilePriority). The tiling check does not rely on tile's |
139 // internal state (it is, in fact, used to determine the tile's state). | 139 // internal state (it is, in fact, used to determine the tile's state). |
140 if (tiling_->IsTileOccluded(current_tile_)) | 140 if (tiling_->IsTileOccluded(current_tile_)) |
141 continue; | 141 continue; |
142 | 142 |
143 // If we get here, that means we have a valid tile that needs raster and is | 143 // If we get here, that means we have a valid tile that needs raster and is |
144 // in the NOW bin, which means that it can be required. | 144 // in the NOW bin, which means that it can be required. |
145 break; | 145 break; |
146 } | 146 } |
147 | 147 |
148 if (current_tile_) | 148 if (current_tile_) |
149 tiling_->UpdateTileAndTwinPriority(current_tile_); | 149 tiling_->UpdateTilePriority(current_tile_); |
150 return *this; | 150 return *this; |
151 } | 151 } |
152 | 152 |
153 } // namespace cc | 153 } // namespace cc |
OLD | NEW |