OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/tiles/raster_tile_priority_queue_all.h" | 5 #include "cc/tiles/raster_tile_priority_queue_all.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "cc/tiles/tiling_set_raster_queue_all.h" | 8 #include "cc/tiles/tiling_set_raster_queue_all.h" |
9 | 9 |
10 namespace cc { | 10 namespace cc { |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 class RasterOrderComparator { | 14 class RasterOrderComparator { |
15 public: | 15 public: |
16 explicit RasterOrderComparator(TreePriority tree_priority) | 16 explicit RasterOrderComparator(TreePriority tree_priority) |
17 : tree_priority_(tree_priority) {} | 17 : tree_priority_(tree_priority) {} |
18 | 18 |
19 bool operator()( | 19 bool operator()( |
danakj
2017/05/25 15:49:02
Can you put a comment here explaining when this re
Khushal
2017/05/25 22:43:22
Yup, this is true if a < b. The comment is already
danakj
2017/05/26 15:46:20
Oh that looks like its commenting on the first lin
Khushal
2017/05/26 18:09:21
Done.
| |
20 const std::unique_ptr<TilingSetRasterQueueAll>& a_queue, | 20 const std::unique_ptr<TilingSetRasterQueueAll>& a_queue, |
21 const std::unique_ptr<TilingSetRasterQueueAll>& b_queue) const { | 21 const std::unique_ptr<TilingSetRasterQueueAll>& b_queue) const { |
22 // Note that in this function, we have to return true if and only if | 22 // Note that in this function, we have to return true if and only if |
23 // a is strictly lower priority than b. | 23 // a is strictly lower priority than b. |
24 | |
24 const TilePriority& a_priority = a_queue->Top().priority(); | 25 const TilePriority& a_priority = a_queue->Top().priority(); |
25 const TilePriority& b_priority = b_queue->Top().priority(); | 26 const TilePriority& b_priority = b_queue->Top().priority(); |
26 bool prioritize_low_res = tree_priority_ == SMOOTHNESS_TAKES_PRIORITY; | 27 bool prioritize_low_res = tree_priority_ == SMOOTHNESS_TAKES_PRIORITY; |
27 | 28 |
29 // If the priority bin is the same but one of the tiles is from a | |
30 // non-drawing layer, then the drawing layer has a higher priority. | |
31 if (b_priority.priority_bin == a_priority.priority_bin && | |
32 b_queue->is_non_drawing_layer() != a_queue->is_non_drawing_layer()) { | |
33 return a_queue->is_non_drawing_layer(); | |
34 } | |
35 | |
28 // If the bin is the same but the resolution is not, then the order will be | 36 // If the bin is the same but the resolution is not, then the order will be |
29 // determined by whether we prioritize low res or not. | 37 // determined by whether we prioritize low res or not. |
30 // TODO(vmpstr): Remove this when TilePriority is no longer a member of Tile | 38 // TODO(vmpstr): Remove this when TilePriority is no longer a member of Tile |
31 // class but instead produced by the iterators. | 39 // class but instead produced by the iterators. |
32 if (b_priority.priority_bin == a_priority.priority_bin && | 40 if (b_priority.priority_bin == a_priority.priority_bin && |
33 b_priority.resolution != a_priority.resolution) { | 41 b_priority.resolution != a_priority.resolution) { |
34 // Non ideal resolution should be sorted lower than other resolutions. | 42 // Non ideal resolution should be sorted lower than other resolutions. |
35 if (a_priority.resolution == NON_IDEAL_RESOLUTION) | 43 if (a_priority.resolution == NON_IDEAL_RESOLUTION) |
36 return true; | 44 return true; |
37 | 45 |
(...skipping 18 matching lines...) Expand all Loading... | |
56 std::vector<std::unique_ptr<TilingSetRasterQueueAll>>* queues) { | 64 std::vector<std::unique_ptr<TilingSetRasterQueueAll>>* queues) { |
57 DCHECK(queues->empty()); | 65 DCHECK(queues->empty()); |
58 | 66 |
59 for (auto* layer : layers) { | 67 for (auto* layer : layers) { |
60 if (!layer->HasValidTilePriorities()) | 68 if (!layer->HasValidTilePriorities()) |
61 continue; | 69 continue; |
62 | 70 |
63 PictureLayerTilingSet* tiling_set = layer->picture_layer_tiling_set(); | 71 PictureLayerTilingSet* tiling_set = layer->picture_layer_tiling_set(); |
64 bool prioritize_low_res = tree_priority == SMOOTHNESS_TAKES_PRIORITY; | 72 bool prioritize_low_res = tree_priority == SMOOTHNESS_TAKES_PRIORITY; |
65 std::unique_ptr<TilingSetRasterQueueAll> tiling_set_queue = | 73 std::unique_ptr<TilingSetRasterQueueAll> tiling_set_queue = |
66 base::MakeUnique<TilingSetRasterQueueAll>(tiling_set, | 74 base::MakeUnique<TilingSetRasterQueueAll>( |
67 prioritize_low_res); | 75 tiling_set, prioritize_low_res, |
76 layer->raster_even_if_not_in_rsll()); | |
68 // Queues will only contain non empty tiling sets. | 77 // Queues will only contain non empty tiling sets. |
69 if (!tiling_set_queue->IsEmpty()) | 78 if (!tiling_set_queue->IsEmpty()) |
70 queues->push_back(std::move(tiling_set_queue)); | 79 queues->push_back(std::move(tiling_set_queue)); |
71 } | 80 } |
72 std::make_heap(queues->begin(), queues->end(), | 81 std::make_heap(queues->begin(), queues->end(), |
73 RasterOrderComparator(tree_priority)); | 82 RasterOrderComparator(tree_priority)); |
74 } | 83 } |
75 | 84 |
76 } // namespace | 85 } // namespace |
77 | 86 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 return active_queues_; | 182 return active_queues_; |
174 return pending_queues_; | 183 return pending_queues_; |
175 } | 184 } |
176 default: | 185 default: |
177 NOTREACHED(); | 186 NOTREACHED(); |
178 return active_queues_; | 187 return active_queues_; |
179 } | 188 } |
180 } | 189 } |
181 | 190 |
182 } // namespace cc | 191 } // namespace cc |
OLD | NEW |