OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_PICTURE_LAYER_TILING_H_ | 5 #ifndef CC_TILES_PICTURE_LAYER_TILING_H_ |
6 #define CC_TILES_PICTURE_LAYER_TILING_H_ | 6 #define CC_TILES_PICTURE_LAYER_TILING_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 }; | 56 }; |
57 | 57 |
58 struct TileMapKey { | 58 struct TileMapKey { |
59 TileMapKey(int x, int y) : index_x(x), index_y(y) {} | 59 TileMapKey(int x, int y) : index_x(x), index_y(y) {} |
60 explicit TileMapKey(const std::pair<int, int>& index) | 60 explicit TileMapKey(const std::pair<int, int>& index) |
61 : index_x(index.first), index_y(index.second) {} | 61 : index_x(index.first), index_y(index.second) {} |
62 | 62 |
63 bool operator==(const TileMapKey& other) const { | 63 bool operator==(const TileMapKey& other) const { |
64 return index_x == other.index_x && index_y == other.index_y; | 64 return index_x == other.index_x && index_y == other.index_y; |
65 } | 65 } |
| 66 bool operator<(const TileMapKey& other) const { |
| 67 return std::tie(index_x, index_y) < std::tie(other.index_x, other.index_y); |
| 68 } |
66 | 69 |
67 int index_x; | 70 int index_x; |
68 int index_y; | 71 int index_y; |
69 }; | 72 }; |
70 | 73 |
71 struct TileMapKeyHash { | 74 struct TileMapKeyHash { |
72 size_t operator()(const TileMapKey& key) const { | 75 size_t operator()(const TileMapKey& key) const { |
73 uint16_t value1 = static_cast<uint16_t>(key.index_x); | 76 uint16_t value1 = static_cast<uint16_t>(key.index_x); |
74 uint16_t value2 = static_cast<uint16_t>(key.index_y); | 77 uint16_t value2 = static_cast<uint16_t>(key.index_y); |
75 uint32_t value1_32 = value1; | 78 uint32_t value1_32 = value1; |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 bool has_eventually_rect_tiles_ = false; | 384 bool has_eventually_rect_tiles_ = false; |
382 bool all_tiles_done_ = true; | 385 bool all_tiles_done_ = true; |
383 | 386 |
384 private: | 387 private: |
385 DISALLOW_COPY_AND_ASSIGN(PictureLayerTiling); | 388 DISALLOW_COPY_AND_ASSIGN(PictureLayerTiling); |
386 }; | 389 }; |
387 | 390 |
388 } // namespace cc | 391 } // namespace cc |
389 | 392 |
390 #endif // CC_TILES_PICTURE_LAYER_TILING_H_ | 393 #endif // CC_TILES_PICTURE_LAYER_TILING_H_ |
OLD | NEW |