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_RESOURCES_PICTURE_LAYER_TILING_H_ | 5 #ifndef CC_RESOURCES_PICTURE_LAYER_TILING_H_ |
6 #define CC_RESOURCES_PICTURE_LAYER_TILING_H_ | 6 #define CC_RESOURCES_PICTURE_LAYER_TILING_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 Tile* current_tile_; | 116 Tile* current_tile_; |
117 TilingData::Iterator visible_iterator_; | 117 TilingData::Iterator visible_iterator_; |
118 TilingData::SpiralDifferenceIterator spiral_iterator_; | 118 TilingData::SpiralDifferenceIterator spiral_iterator_; |
119 }; | 119 }; |
120 | 120 |
121 class CC_EXPORT TilingEvictionTileIterator { | 121 class CC_EXPORT TilingEvictionTileIterator { |
122 public: | 122 public: |
123 TilingEvictionTileIterator(); | 123 TilingEvictionTileIterator(); |
124 TilingEvictionTileIterator(PictureLayerTiling* tiling, | 124 TilingEvictionTileIterator(PictureLayerTiling* tiling, |
125 TreePriority tree_priority, | 125 TreePriority tree_priority, |
126 EvictionCategory category); | 126 EvictionCategory category, |
| 127 bool use_tile_priority_rects, |
| 128 bool use_twin_tile_priority_rects); |
127 ~TilingEvictionTileIterator(); | 129 ~TilingEvictionTileIterator(); |
128 | 130 |
129 operator bool() const; | 131 operator bool() const; |
130 const Tile* operator*() const; | 132 const Tile* operator*() const; |
131 Tile* operator*(); | 133 Tile* operator*(); |
132 TilingEvictionTileIterator& operator++(); | 134 TilingEvictionTileIterator& operator++(); |
133 | 135 |
134 private: | 136 private: |
135 const std::vector<Tile*>* eviction_tiles_; | 137 const std::vector<Tile*>* eviction_tiles_; |
136 size_t current_eviction_tiles_index_; | 138 size_t current_eviction_tiles_index_; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 176 |
175 std::vector<Tile*> AllTilesForTesting() const { | 177 std::vector<Tile*> AllTilesForTesting() const { |
176 std::vector<Tile*> all_tiles; | 178 std::vector<Tile*> all_tiles; |
177 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) | 179 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) |
178 all_tiles.push_back(it->second.get()); | 180 all_tiles.push_back(it->second.get()); |
179 return all_tiles; | 181 return all_tiles; |
180 } | 182 } |
181 | 183 |
182 void UpdateAllTilePrioritiesForTesting() { | 184 void UpdateAllTilePrioritiesForTesting() { |
183 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) | 185 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) |
184 UpdateTileAndTwinPriority(it->second.get()); | 186 UpdateTileAndTwinPriority(it->second.get(), true, true); |
185 } | 187 } |
186 | 188 |
187 std::vector<scoped_refptr<Tile>> AllRefTilesForTesting() const { | 189 std::vector<scoped_refptr<Tile>> AllRefTilesForTesting() const { |
188 std::vector<scoped_refptr<Tile>> all_tiles; | 190 std::vector<scoped_refptr<Tile>> all_tiles; |
189 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) | 191 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) |
190 all_tiles.push_back(it->second); | 192 all_tiles.push_back(it->second); |
191 return all_tiles; | 193 return all_tiles; |
192 } | 194 } |
193 | 195 |
194 void SetAllTilesOccludedForTesting() { | 196 void SetAllTilesOccludedForTesting() { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 bool RemoveTileAt(int i, int j, PictureLayerTiling* recycled_twin); | 315 bool RemoveTileAt(int i, int j, PictureLayerTiling* recycled_twin); |
314 | 316 |
315 // Computes a skewport. The calculation extrapolates the last visible | 317 // Computes a skewport. The calculation extrapolates the last visible |
316 // rect and the current visible rect to expand the skewport to where it | 318 // rect and the current visible rect to expand the skewport to where it |
317 // would be in |skewport_target_time| seconds. Note that the skewport | 319 // would be in |skewport_target_time| seconds. Note that the skewport |
318 // is guaranteed to contain the current visible rect. | 320 // is guaranteed to contain the current visible rect. |
319 gfx::Rect ComputeSkewport(double current_frame_time_in_seconds, | 321 gfx::Rect ComputeSkewport(double current_frame_time_in_seconds, |
320 const gfx::Rect& visible_rect_in_content_space) | 322 const gfx::Rect& visible_rect_in_content_space) |
321 const; | 323 const; |
322 | 324 |
323 void UpdateEvictionCacheIfNeeded(TreePriority tree_priority); | 325 void UpdateEvictionCacheIfNeeded(TreePriority tree_priority, |
324 const std::vector<Tile*>* GetEvictionTiles(TreePriority tree_priority, | 326 bool tiling_has_valid_tile_priorities, |
325 EvictionCategory category); | 327 bool twin_tiling_has_valid_tile_priorities); |
| 328 const std::vector<Tile*>* GetEvictionTiles( |
| 329 TreePriority tree_priority, |
| 330 EvictionCategory category, |
| 331 bool tiling_has_valid_tile_priorities, |
| 332 bool twin_tiling_has_valid_tile_priorities); |
326 | 333 |
327 void Invalidate(const Region& layer_region); | 334 void Invalidate(const Region& layer_region); |
328 | 335 |
329 void DoInvalidate(const Region& layer_region, | 336 void DoInvalidate(const Region& layer_region, |
330 bool recreate_invalidated_tiles); | 337 bool recreate_invalidated_tiles); |
331 | 338 |
332 void UpdateTileAndTwinPriority(Tile* tile) const; | 339 void UpdateTileAndTwinPriority(Tile* tile, |
| 340 bool use_tile_priority_rects, |
| 341 bool use_twin_tile_priority_rects) const; |
333 void UpdateTilePriority(Tile* tile) const; | 342 void UpdateTilePriority(Tile* tile) const; |
334 | 343 |
335 // Given properties. | 344 // Given properties. |
336 float contents_scale_; | 345 float contents_scale_; |
337 gfx::Size layer_bounds_; | 346 gfx::Size layer_bounds_; |
338 TileResolution resolution_; | 347 TileResolution resolution_; |
339 PictureLayerTilingClient* client_; | 348 PictureLayerTilingClient* client_; |
340 | 349 |
341 // Internal data. | 350 // Internal data. |
342 TilingData tiling_data_; | 351 TilingData tiling_data_; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 388 |
380 private: | 389 private: |
381 DISALLOW_ASSIGN(PictureLayerTiling); | 390 DISALLOW_ASSIGN(PictureLayerTiling); |
382 | 391 |
383 RectExpansionCache expansion_cache_; | 392 RectExpansionCache expansion_cache_; |
384 }; | 393 }; |
385 | 394 |
386 } // namespace cc | 395 } // namespace cc |
387 | 396 |
388 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ | 397 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ |
OLD | NEW |