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 13 matching lines...) Expand all Loading... |
24 // PictureLayerTiling::IsTileRequiredFor*, which all return false if the | 24 // PictureLayerTiling::IsTileRequiredFor*, which all return false if the |
25 // resolution is not HIGH_RESOLUTION. | 25 // resolution is not HIGH_RESOLUTION. |
26 PictureLayerTiling* tiling = | 26 PictureLayerTiling* tiling = |
27 tiling_set->FindTilingWithResolution(HIGH_RESOLUTION); | 27 tiling_set->FindTilingWithResolution(HIGH_RESOLUTION); |
28 // If we don't have a high res tiling, then this queue will yield no tiles. | 28 // If we don't have a high res tiling, then this queue will yield no tiles. |
29 // See PictureLayerImpl::CanHaveTilings for examples of when a HIGH_RESOLUTION | 29 // See PictureLayerImpl::CanHaveTilings for examples of when a HIGH_RESOLUTION |
30 // tiling would not be generated. | 30 // tiling would not be generated. |
31 if (!tiling) | 31 if (!tiling) |
32 return; | 32 return; |
33 | 33 |
34 iterator_ = TilingIterator(tiling, &tiling->tiling_data_); | 34 if (type == RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION) { |
| 35 iterator_ = TilingIterator(tiling, &tiling->tiling_data_, |
| 36 tiling->pending_visible_rect()); |
| 37 } else { |
| 38 iterator_ = TilingIterator(tiling, &tiling->tiling_data_, |
| 39 tiling->current_visible_rect()); |
| 40 } |
35 while (!iterator_.done() && !IsTileRequired(*iterator_)) | 41 while (!iterator_.done() && !IsTileRequired(*iterator_)) |
36 ++iterator_; | 42 ++iterator_; |
37 } | 43 } |
38 | 44 |
39 TilingSetRasterQueueRequired::~TilingSetRasterQueueRequired() { | 45 TilingSetRasterQueueRequired::~TilingSetRasterQueueRequired() { |
40 } | 46 } |
41 | 47 |
42 bool TilingSetRasterQueueRequired::IsEmpty() const { | 48 bool TilingSetRasterQueueRequired::IsEmpty() const { |
43 return iterator_.done(); | 49 return iterator_.done(); |
44 } | 50 } |
(...skipping 21 matching lines...) Expand all Loading... |
66 (type_ == RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW && | 72 (type_ == RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW && |
67 tile->required_for_draw()); | 73 tile->required_for_draw()); |
68 } | 74 } |
69 | 75 |
70 TilingSetRasterQueueRequired::TilingIterator::TilingIterator() | 76 TilingSetRasterQueueRequired::TilingIterator::TilingIterator() |
71 : tiling_(nullptr), current_tile_(nullptr) { | 77 : tiling_(nullptr), current_tile_(nullptr) { |
72 } | 78 } |
73 | 79 |
74 TilingSetRasterQueueRequired::TilingIterator::TilingIterator( | 80 TilingSetRasterQueueRequired::TilingIterator::TilingIterator( |
75 PictureLayerTiling* tiling, | 81 PictureLayerTiling* tiling, |
76 TilingData* tiling_data) | 82 TilingData* tiling_data, |
| 83 const gfx::Rect& rect) |
77 : tiling_(tiling), tiling_data_(tiling_data), current_tile_(nullptr) { | 84 : tiling_(tiling), tiling_data_(tiling_data), current_tile_(nullptr) { |
78 if (!tiling_->has_visible_rect_tiles()) { | |
79 // Verify that if we would create the iterator, then it would be empty (ie | |
80 // it would return false when evaluated as a bool). | |
81 DCHECK(!TilingData::Iterator(tiling_data_, tiling->current_visible_rect(), | |
82 false)); | |
83 return; | |
84 } | |
85 | |
86 visible_iterator_ = | 85 visible_iterator_ = |
87 TilingData::Iterator(tiling_data_, tiling_->current_visible_rect(), | 86 TilingData::Iterator(tiling_data_, rect, false /* include_borders */); |
88 false /* include_borders */); | |
89 if (!visible_iterator_) | 87 if (!visible_iterator_) |
90 return; | 88 return; |
91 | 89 |
92 current_tile_ = | 90 current_tile_ = |
93 tiling_->TileAt(visible_iterator_.index_x(), visible_iterator_.index_y()); | 91 tiling_->TileAt(visible_iterator_.index_x(), visible_iterator_.index_y()); |
94 | 92 |
95 // If this is a valid tile, return it. Note that we have to use a tiling check | 93 // If this is a valid tile, return it. Note that we have to use a tiling check |
96 // for occlusion, since the tile's internal state has not yet been updated. | 94 // for occlusion, since the tile's internal state has not yet been updated. |
97 if (current_tile_ && current_tile_->NeedsRaster() && | 95 if (current_tile_ && current_tile_->NeedsRaster() && |
98 !tiling_->IsTileOccluded(current_tile_)) { | 96 !tiling_->IsTileOccluded(current_tile_)) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // in the NOW bin, which means that it can be required. | 130 // in the NOW bin, which means that it can be required. |
133 break; | 131 break; |
134 } | 132 } |
135 | 133 |
136 if (current_tile_) | 134 if (current_tile_) |
137 tiling_->UpdateTileAndTwinPriority(current_tile_); | 135 tiling_->UpdateTileAndTwinPriority(current_tile_); |
138 return *this; | 136 return *this; |
139 } | 137 } |
140 | 138 |
141 } // namespace cc | 139 } // namespace cc |
OLD | NEW |