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 <map> | 8 #include <map> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 virtual const Region* GetPendingInvalidation() = 0; | 45 virtual const Region* GetPendingInvalidation() = 0; |
46 virtual const PictureLayerTiling* GetPendingOrActiveTwinTiling( | 46 virtual const PictureLayerTiling* GetPendingOrActiveTwinTiling( |
47 const PictureLayerTiling* tiling) const = 0; | 47 const PictureLayerTiling* tiling) const = 0; |
48 virtual TilePriority::PriorityBin GetMaxTilePriorityBin() const = 0; | 48 virtual TilePriority::PriorityBin GetMaxTilePriorityBin() const = 0; |
49 virtual bool RequiresHighResToDraw() const = 0; | 49 virtual bool RequiresHighResToDraw() const = 0; |
50 | 50 |
51 protected: | 51 protected: |
52 virtual ~PictureLayerTilingClient() {} | 52 virtual ~PictureLayerTilingClient() {} |
53 }; | 53 }; |
54 | 54 |
| 55 struct TileMapKey { |
| 56 TileMapKey(int x, int y) : index_x(x), index_y(y) {} |
| 57 explicit TileMapKey(const std::pair<int, int>& index) |
| 58 : index_x(index.first), index_y(index.second) {} |
| 59 |
| 60 bool operator==(const TileMapKey& other) const { |
| 61 return index_x == other.index_x && index_y == other.index_y; |
| 62 } |
| 63 |
| 64 int index_x; |
| 65 int index_y; |
| 66 }; |
| 67 |
| 68 } // namespace cc |
| 69 |
| 70 namespace BASE_HASH_NAMESPACE { |
| 71 template <> |
| 72 struct hash<cc::TileMapKey> { |
| 73 size_t operator()(const cc::TileMapKey& key) const { |
| 74 uint16 value1 = static_cast<uint16>(key.index_x); |
| 75 uint16 value2 = static_cast<uint16>(key.index_y); |
| 76 uint32 value1_32 = value1; |
| 77 return (value1_32 << 16) | value2; |
| 78 } |
| 79 }; |
| 80 } // namespace BASE_HASH_NAMESPACE |
| 81 |
| 82 namespace cc { |
| 83 |
55 class CC_EXPORT PictureLayerTiling { | 84 class CC_EXPORT PictureLayerTiling { |
56 public: | 85 public: |
57 static const int kBorderTexels = 1; | 86 static const int kBorderTexels = 1; |
58 | 87 |
59 PictureLayerTilingClient* client() const { return client_; } | 88 PictureLayerTilingClient* client() const { return client_; } |
60 ~PictureLayerTiling(); | 89 ~PictureLayerTiling(); |
61 | 90 |
62 static float CalculateSoonBorderDistance( | 91 static float CalculateSoonBorderDistance( |
63 const gfx::Rect& visible_rect_in_content_space, | 92 const gfx::Rect& visible_rect_in_content_space, |
64 float content_to_screen_scale); | 93 float content_to_screen_scale); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 // here. Note that when processing a pending tree, this rect is the same as | 247 // here. Note that when processing a pending tree, this rect is the same as |
219 // the visible rect so no tiles are processed in this case. | 248 // the visible rect so no tiles are processed in this case. |
220 enum PriorityRectType { | 249 enum PriorityRectType { |
221 VISIBLE_RECT, | 250 VISIBLE_RECT, |
222 PENDING_VISIBLE_RECT, | 251 PENDING_VISIBLE_RECT, |
223 SKEWPORT_RECT, | 252 SKEWPORT_RECT, |
224 SOON_BORDER_RECT, | 253 SOON_BORDER_RECT, |
225 EVENTUALLY_RECT | 254 EVENTUALLY_RECT |
226 }; | 255 }; |
227 | 256 |
228 using TileMapKey = std::pair<int, int>; | |
229 using TileMap = base::ScopedPtrHashMap<TileMapKey, ScopedTilePtr>; | 257 using TileMap = base::ScopedPtrHashMap<TileMapKey, ScopedTilePtr>; |
230 | 258 |
231 struct FrameVisibleRect { | 259 struct FrameVisibleRect { |
232 gfx::Rect visible_rect_in_content_space; | 260 gfx::Rect visible_rect_in_content_space; |
233 double frame_time_in_seconds = 0.0; | 261 double frame_time_in_seconds = 0.0; |
234 }; | 262 }; |
235 | 263 |
236 PictureLayerTiling(WhichTree tree, | 264 PictureLayerTiling(WhichTree tree, |
237 float contents_scale, | 265 float contents_scale, |
238 scoped_refptr<RasterSource> raster_source, | 266 scoped_refptr<RasterSource> raster_source, |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 | 390 |
363 private: | 391 private: |
364 DISALLOW_ASSIGN(PictureLayerTiling); | 392 DISALLOW_ASSIGN(PictureLayerTiling); |
365 | 393 |
366 RectExpansionCache expansion_cache_; | 394 RectExpansionCache expansion_cache_; |
367 }; | 395 }; |
368 | 396 |
369 } // namespace cc | 397 } // namespace cc |
370 | 398 |
371 #endif // CC_TILES_PICTURE_LAYER_TILING_H_ | 399 #endif // CC_TILES_PICTURE_LAYER_TILING_H_ |
OLD | NEW |