Chromium Code Reviews| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 57 protected: | 57 protected: |
| 58 virtual ~PictureLayerTilingClient() {} | 58 virtual ~PictureLayerTilingClient() {} |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 class CC_EXPORT PictureLayerTiling { | 61 class CC_EXPORT PictureLayerTiling { |
| 62 public: | 62 public: |
| 63 static const int kBorderTexels = 1; | 63 static const int kBorderTexels = 1; |
| 64 | 64 |
| 65 enum EvictionCategory { | 65 enum EvictionCategory { |
| 66 EVENTUALLY, | 66 EVENTUALLY, |
| 67 EVENTUALLY_AND_REQUIRED_FOR_ACTIVATION, | |
| 68 SOON, | 67 SOON, |
| 69 SOON_AND_REQUIRED_FOR_ACTIVATION, | |
| 70 NOW, | 68 NOW, |
| 71 NOW_AND_REQUIRED_FOR_ACTIVATION | 69 NOW_AND_REQUIRED_FOR_ACTIVATION |
| 72 }; | 70 }; |
| 73 | 71 |
| 74 class CC_EXPORT TilingRasterTileIterator { | 72 class CC_EXPORT TilingRasterTileIterator { |
| 75 public: | 73 public: |
| 76 TilingRasterTileIterator(); | 74 TilingRasterTileIterator(); |
| 77 explicit TilingRasterTileIterator(PictureLayerTiling* tiling); | 75 explicit TilingRasterTileIterator(PictureLayerTiling* tiling); |
| 78 ~TilingRasterTileIterator(); | 76 ~TilingRasterTileIterator(); |
| 79 | 77 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 | 113 |
| 116 Tile* current_tile_; | 114 Tile* current_tile_; |
| 117 TilingData::Iterator visible_iterator_; | 115 TilingData::Iterator visible_iterator_; |
| 118 TilingData::SpiralDifferenceIterator spiral_iterator_; | 116 TilingData::SpiralDifferenceIterator spiral_iterator_; |
| 119 }; | 117 }; |
| 120 | 118 |
| 121 class CC_EXPORT TilingEvictionTileIterator { | 119 class CC_EXPORT TilingEvictionTileIterator { |
| 122 public: | 120 public: |
| 123 TilingEvictionTileIterator(); | 121 TilingEvictionTileIterator(); |
| 124 TilingEvictionTileIterator(PictureLayerTiling* tiling, | 122 TilingEvictionTileIterator(PictureLayerTiling* tiling, |
| 125 TreePriority tree_priority, | |
| 126 EvictionCategory category); | 123 EvictionCategory category); |
| 127 ~TilingEvictionTileIterator(); | 124 ~TilingEvictionTileIterator(); |
| 128 | 125 |
| 129 operator bool() const; | 126 operator bool() const; |
| 130 const Tile* operator*() const; | 127 const Tile* operator*() const; |
| 131 Tile* operator*(); | 128 Tile* operator*(); |
| 132 TilingEvictionTileIterator& operator++(); | 129 TilingEvictionTileIterator& operator++(); |
| 133 | 130 |
| 134 private: | 131 private: |
| 135 const std::vector<Tile*>* eviction_tiles_; | 132 void AdvanceEventually(bool first_run); |
| 136 size_t current_eviction_tiles_index_; | 133 void AdvanceSoon(bool first_run); |
| 134 void AdvanceNow(bool first_run); | |
|
reveman
2014/11/11 00:13:27
If I understand the code correctly, which one of t
vmpstr
2014/11/11 22:02:53
Correct.
| |
| 135 | |
| 136 PictureLayerTiling* tiling_; | |
| 137 EvictionCategory eviction_category_; | |
| 138 | |
| 139 bool processing_occluded_now_tiles_; | |
| 140 bool processing_soon_border_rect_; | |
| 141 std::vector<Tile*> unoccluded_now_tiles_; | |
|
reveman
2014/11/11 00:13:27
can you do two passes instead of having this vecto
vmpstr
2014/11/11 22:54:51
Done.
| |
| 142 size_t unoccluded_now_tiles_index_; | |
| 143 | |
| 144 Tile* current_tile_; | |
| 145 | |
| 146 TilingData::Iterator visible_iterator_; | |
| 147 TilingData::ReverseSpiralDifferenceIterator spiral_iterator_; | |
| 137 }; | 148 }; |
| 138 | 149 |
| 139 ~PictureLayerTiling(); | 150 ~PictureLayerTiling(); |
| 140 | 151 |
| 141 // Create a tiling with no tiles. CreateTiles must be called to add some. | 152 // Create a tiling with no tiles. CreateTiles must be called to add some. |
| 142 static scoped_ptr<PictureLayerTiling> Create( | 153 static scoped_ptr<PictureLayerTiling> Create( |
| 143 float contents_scale, | 154 float contents_scale, |
| 144 const gfx::Size& layer_bounds, | 155 const gfx::Size& layer_bounds, |
| 145 PictureLayerTilingClient* client); | 156 PictureLayerTilingClient* client); |
| 146 gfx::Size layer_bounds() const { return layer_bounds_; } | 157 gfx::Size layer_bounds() const { return layer_bounds_; } |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 313 bool RemoveTileAt(int i, int j, PictureLayerTiling* recycled_twin); | 324 bool RemoveTileAt(int i, int j, PictureLayerTiling* recycled_twin); |
| 314 | 325 |
| 315 // Computes a skewport. The calculation extrapolates the last visible | 326 // Computes a skewport. The calculation extrapolates the last visible |
| 316 // rect and the current visible rect to expand the skewport to where it | 327 // 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 | 328 // would be in |skewport_target_time| seconds. Note that the skewport |
| 318 // is guaranteed to contain the current visible rect. | 329 // is guaranteed to contain the current visible rect. |
| 319 gfx::Rect ComputeSkewport(double current_frame_time_in_seconds, | 330 gfx::Rect ComputeSkewport(double current_frame_time_in_seconds, |
| 320 const gfx::Rect& visible_rect_in_content_space) | 331 const gfx::Rect& visible_rect_in_content_space) |
| 321 const; | 332 const; |
| 322 | 333 |
| 323 void UpdateEvictionCacheIfNeeded(TreePriority tree_priority); | |
| 324 const std::vector<Tile*>* GetEvictionTiles(TreePriority tree_priority, | |
| 325 EvictionCategory category); | |
| 326 | |
| 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) const; |
| 333 void UpdateTilePriority(Tile* tile) const; | 340 void UpdateTilePriority(Tile* tile) const; |
| 334 | 341 |
| 335 // Given properties. | 342 // Given properties. |
| 336 float contents_scale_; | 343 float contents_scale_; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 357 gfx::Rect current_soon_border_rect_; | 364 gfx::Rect current_soon_border_rect_; |
| 358 gfx::Rect current_eventually_rect_; | 365 gfx::Rect current_eventually_rect_; |
| 359 | 366 |
| 360 bool has_visible_rect_tiles_; | 367 bool has_visible_rect_tiles_; |
| 361 bool has_skewport_rect_tiles_; | 368 bool has_skewport_rect_tiles_; |
| 362 bool has_soon_border_rect_tiles_; | 369 bool has_soon_border_rect_tiles_; |
| 363 bool has_eventually_rect_tiles_; | 370 bool has_eventually_rect_tiles_; |
| 364 | 371 |
| 365 Occlusion current_occlusion_in_layer_space_; | 372 Occlusion current_occlusion_in_layer_space_; |
| 366 | 373 |
| 367 // TODO(reveman): Remove this in favour of an array of eviction_tiles_ when we | |
| 368 // change all enums to have a consistent way of getting the count/last | |
| 369 // element. | |
| 370 std::vector<Tile*> eviction_tiles_now_; | |
| 371 std::vector<Tile*> eviction_tiles_now_and_required_for_activation_; | |
| 372 std::vector<Tile*> eviction_tiles_soon_; | |
| 373 std::vector<Tile*> eviction_tiles_soon_and_required_for_activation_; | |
| 374 std::vector<Tile*> eviction_tiles_eventually_; | |
| 375 std::vector<Tile*> eviction_tiles_eventually_and_required_for_activation_; | |
| 376 | |
| 377 bool eviction_tiles_cache_valid_; | |
| 378 TreePriority eviction_cache_tree_priority_; | |
| 379 | |
| 380 private: | 374 private: |
| 381 DISALLOW_ASSIGN(PictureLayerTiling); | 375 DISALLOW_ASSIGN(PictureLayerTiling); |
| 382 | 376 |
| 383 RectExpansionCache expansion_cache_; | 377 RectExpansionCache expansion_cache_; |
| 384 }; | 378 }; |
| 385 | 379 |
| 386 } // namespace cc | 380 } // namespace cc |
| 387 | 381 |
| 388 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ | 382 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ |
| OLD | NEW |