OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/prioritized_tile_set.h" | 5 #include "cc/resources/prioritized_tile_set.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "cc/resources/managed_tile_state.h" | 9 #include "cc/resources/managed_tile_state.h" |
10 #include "cc/resources/tile.h" | 10 #include "cc/resources/tile.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 gfx::Rect a_rect = a->content_rect(); | 33 gfx::Rect a_rect = a->content_rect(); |
34 gfx::Rect b_rect = b->content_rect(); | 34 gfx::Rect b_rect = b->content_rect(); |
35 if (a_rect.y() != b_rect.y()) | 35 if (a_rect.y() != b_rect.y()) |
36 return a_rect.y() < b_rect.y(); | 36 return a_rect.y() < b_rect.y(); |
37 return a_rect.x() < b_rect.x(); | 37 return a_rect.x() < b_rect.x(); |
38 } | 38 } |
39 }; | 39 }; |
40 | 40 |
41 namespace { | 41 namespace { |
42 | 42 |
| 43 bool TilePriorityTieBreaker(const Tile* tile_i, const Tile* tile_j) { |
| 44 // When two tiles has same priority use Id as tie breaker. |
| 45 return tile_i->id() < tile_j->id(); |
| 46 } |
| 47 |
43 typedef std::vector<Tile*> TileVector; | 48 typedef std::vector<Tile*> TileVector; |
44 | 49 |
45 void SortBinTiles(ManagedTileBin bin, TileVector* tiles) { | 50 void SortBinTiles(ManagedTileBin bin, TileVector* tiles) { |
46 switch (bin) { | 51 switch (bin) { |
| 52 case NEVER_BIN: |
| 53 break; |
47 case NOW_AND_READY_TO_DRAW_BIN: | 54 case NOW_AND_READY_TO_DRAW_BIN: |
48 case NEVER_BIN: | 55 std::sort(tiles->begin(), tiles->end(), TilePriorityTieBreaker); |
49 break; | 56 break; |
50 case NOW_BIN: | 57 case NOW_BIN: |
51 case SOON_BIN: | 58 case SOON_BIN: |
52 case EVENTUALLY_AND_ACTIVE_BIN: | 59 case EVENTUALLY_AND_ACTIVE_BIN: |
53 case EVENTUALLY_BIN: | 60 case EVENTUALLY_BIN: |
54 case AT_LAST_AND_ACTIVE_BIN: | 61 case AT_LAST_AND_ACTIVE_BIN: |
55 case AT_LAST_BIN: | 62 case AT_LAST_BIN: |
56 std::sort(tiles->begin(), tiles->end(), BinComparator()); | 63 std::sort(tiles->begin(), tiles->end(), BinComparator()); |
57 break; | 64 break; |
58 default: | 65 default: |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 if (use_priority_ordering_) | 146 if (use_priority_ordering_) |
140 tile_set_->SortBinIfNeeded(current_bin_); | 147 tile_set_->SortBinIfNeeded(current_bin_); |
141 | 148 |
142 iterator_ = tile_set_->tiles_[current_bin_].begin(); | 149 iterator_ = tile_set_->tiles_[current_bin_].begin(); |
143 if (iterator_ != tile_set_->tiles_[current_bin_].end()) | 150 if (iterator_ != tile_set_->tiles_[current_bin_].end()) |
144 break; | 151 break; |
145 } | 152 } |
146 } | 153 } |
147 | 154 |
148 } // namespace cc | 155 } // namespace cc |
OLD | NEW |