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