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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 TreePriority tree_priority, | 123 TreePriority tree_priority, |
124 EvictionCategory category); | 124 EvictionCategory category); |
125 ~TilingEvictionTileIterator(); | 125 ~TilingEvictionTileIterator(); |
126 | 126 |
127 operator bool() const; | 127 operator bool() const; |
128 const Tile* operator*() const; | 128 const Tile* operator*() const; |
129 Tile* operator*(); | 129 Tile* operator*(); |
130 TilingEvictionTileIterator& operator++(); | 130 TilingEvictionTileIterator& operator++(); |
131 | 131 |
132 private: | 132 private: |
133 const std::vector<Tile*>* eviction_tiles_; | 133 void AdvanceEventually(bool first_run); |
134 size_t current_eviction_tiles_index_; | 134 void AdvanceSoon(bool first_run); |
| 135 void AdvanceNow(bool first_run); |
| 136 |
| 137 PictureLayerTiling* tiling_; |
| 138 EvictionCategory eviction_category_; |
| 139 |
| 140 bool processing_occluded_now_tiles_; |
| 141 bool processing_soon_border_rect_; |
| 142 std::vector<Tile*> unoccluded_now_tiles_; |
| 143 size_t unoccluded_now_tiles_index_; |
| 144 |
| 145 Tile* current_tile_; |
| 146 |
| 147 TilingData::Iterator visible_iterator_; |
| 148 TilingData::ReverseSpiralDifferenceIterator spiral_iterator_; |
135 }; | 149 }; |
136 | 150 |
137 ~PictureLayerTiling(); | 151 ~PictureLayerTiling(); |
138 | 152 |
139 // Create a tiling with no tiles. CreateTiles must be called to add some. | 153 // Create a tiling with no tiles. CreateTiles must be called to add some. |
140 static scoped_ptr<PictureLayerTiling> Create( | 154 static scoped_ptr<PictureLayerTiling> Create( |
141 float contents_scale, | 155 float contents_scale, |
142 const gfx::Size& layer_bounds, | 156 const gfx::Size& layer_bounds, |
143 PictureLayerTilingClient* client); | 157 PictureLayerTilingClient* client); |
144 gfx::Size layer_bounds() const { return layer_bounds_; } | 158 gfx::Size layer_bounds() const { return layer_bounds_; } |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 bool RemoveTileAt(int i, int j, PictureLayerTiling* recycled_twin); | 322 bool RemoveTileAt(int i, int j, PictureLayerTiling* recycled_twin); |
309 | 323 |
310 // Computes a skewport. The calculation extrapolates the last visible | 324 // Computes a skewport. The calculation extrapolates the last visible |
311 // rect and the current visible rect to expand the skewport to where it | 325 // rect and the current visible rect to expand the skewport to where it |
312 // would be in |skewport_target_time| seconds. Note that the skewport | 326 // would be in |skewport_target_time| seconds. Note that the skewport |
313 // is guaranteed to contain the current visible rect. | 327 // is guaranteed to contain the current visible rect. |
314 gfx::Rect ComputeSkewport(double current_frame_time_in_seconds, | 328 gfx::Rect ComputeSkewport(double current_frame_time_in_seconds, |
315 const gfx::Rect& visible_rect_in_content_space) | 329 const gfx::Rect& visible_rect_in_content_space) |
316 const; | 330 const; |
317 | 331 |
318 void UpdateEvictionCacheIfNeeded(TreePriority tree_priority); | |
319 const std::vector<Tile*>* GetEvictionTiles(TreePriority tree_priority, | |
320 EvictionCategory category); | |
321 | |
322 void Invalidate(const Region& layer_region); | 332 void Invalidate(const Region& layer_region); |
323 | 333 |
324 void DoInvalidate(const Region& layer_region, | 334 void DoInvalidate(const Region& layer_region, |
325 bool recreate_invalidated_tiles); | 335 bool recreate_invalidated_tiles); |
326 | 336 |
327 void UpdateTileAndTwinPriority(Tile* tile) const; | 337 void UpdateTileAndTwinPriority(Tile* tile) const; |
328 void UpdateTilePriority(Tile* tile) const; | 338 void UpdateTilePriority(Tile* tile) const; |
329 | 339 |
330 // Given properties. | 340 // Given properties. |
331 float contents_scale_; | 341 float contents_scale_; |
(...skipping 19 matching lines...) Expand all Loading... |
351 gfx::Rect current_soon_border_rect_; | 361 gfx::Rect current_soon_border_rect_; |
352 gfx::Rect current_eventually_rect_; | 362 gfx::Rect current_eventually_rect_; |
353 | 363 |
354 bool has_visible_rect_tiles_; | 364 bool has_visible_rect_tiles_; |
355 bool has_skewport_rect_tiles_; | 365 bool has_skewport_rect_tiles_; |
356 bool has_soon_border_rect_tiles_; | 366 bool has_soon_border_rect_tiles_; |
357 bool has_eventually_rect_tiles_; | 367 bool has_eventually_rect_tiles_; |
358 | 368 |
359 Occlusion current_occlusion_in_layer_space_; | 369 Occlusion current_occlusion_in_layer_space_; |
360 | 370 |
361 // TODO(reveman): Remove this in favour of an array of eviction_tiles_ when we | |
362 // change all enums to have a consistent way of getting the count/last | |
363 // element. | |
364 std::vector<Tile*> eviction_tiles_now_; | |
365 std::vector<Tile*> eviction_tiles_now_and_required_for_activation_; | |
366 std::vector<Tile*> eviction_tiles_soon_; | |
367 std::vector<Tile*> eviction_tiles_soon_and_required_for_activation_; | |
368 std::vector<Tile*> eviction_tiles_eventually_; | |
369 std::vector<Tile*> eviction_tiles_eventually_and_required_for_activation_; | |
370 | |
371 bool eviction_tiles_cache_valid_; | |
372 TreePriority eviction_cache_tree_priority_; | |
373 | |
374 private: | 371 private: |
375 DISALLOW_ASSIGN(PictureLayerTiling); | 372 DISALLOW_ASSIGN(PictureLayerTiling); |
376 | 373 |
377 RectExpansionCache expansion_cache_; | 374 RectExpansionCache expansion_cache_; |
378 }; | 375 }; |
379 | 376 |
380 } // namespace cc | 377 } // namespace cc |
381 | 378 |
382 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ | 379 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ |
OLD | NEW |