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); | |
135 | |
136 PictureLayerTiling* tiling_; | |
137 EvictionCategory eviction_category_; | |
138 | |
139 bool processing_occluded_now_tiles_; | |
140 bool processing_soon_border_rect_; | |
141 | |
142 Tile* current_tile_; | |
143 | |
144 TilingData::Iterator visible_iterator_; | |
reveman
2014/11/18 20:56:21
Would it hurt to use a ReverseSpiralDifferenceIter
| |
145 TilingData::ReverseSpiralDifferenceIterator spiral_iterator_; | |
137 }; | 146 }; |
138 | 147 |
139 ~PictureLayerTiling(); | 148 ~PictureLayerTiling(); |
140 | 149 |
141 // Create a tiling with no tiles. CreateTiles must be called to add some. | 150 // Create a tiling with no tiles. CreateTiles must be called to add some. |
142 static scoped_ptr<PictureLayerTiling> Create( | 151 static scoped_ptr<PictureLayerTiling> Create( |
143 float contents_scale, | 152 float contents_scale, |
144 const gfx::Size& layer_bounds, | 153 const gfx::Size& layer_bounds, |
145 PictureLayerTilingClient* client); | 154 PictureLayerTilingClient* client); |
146 gfx::Size layer_bounds() const { return layer_bounds_; } | 155 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); | 323 bool RemoveTileAt(int i, int j, PictureLayerTiling* recycled_twin); |
315 | 324 |
316 // Computes a skewport. The calculation extrapolates the last visible | 325 // Computes a skewport. The calculation extrapolates the last visible |
317 // rect and the current visible rect to expand the skewport to where it | 326 // 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 | 327 // would be in |skewport_target_time| seconds. Note that the skewport |
319 // is guaranteed to contain the current visible rect. | 328 // is guaranteed to contain the current visible rect. |
320 gfx::Rect ComputeSkewport(double current_frame_time_in_seconds, | 329 gfx::Rect ComputeSkewport(double current_frame_time_in_seconds, |
321 const gfx::Rect& visible_rect_in_content_space) | 330 const gfx::Rect& visible_rect_in_content_space) |
322 const; | 331 const; |
323 | 332 |
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); | 333 void Invalidate(const Region& layer_region); |
329 | 334 |
330 void DoInvalidate(const Region& layer_region, | 335 void DoInvalidate(const Region& layer_region, |
331 bool recreate_invalidated_tiles); | 336 bool recreate_invalidated_tiles); |
332 | 337 |
333 void UpdateTileAndTwinPriority(Tile* tile) const; | 338 void UpdateTileAndTwinPriority(Tile* tile) const; |
334 void UpdateTilePriority(Tile* tile) const; | 339 void UpdateTilePriority(Tile* tile) const; |
335 | 340 |
336 // Given properties. | 341 // Given properties. |
337 float contents_scale_; | 342 float contents_scale_; |
(...skipping 20 matching lines...) Expand all Loading... | |
358 gfx::Rect current_soon_border_rect_; | 363 gfx::Rect current_soon_border_rect_; |
359 gfx::Rect current_eventually_rect_; | 364 gfx::Rect current_eventually_rect_; |
360 | 365 |
361 bool has_visible_rect_tiles_; | 366 bool has_visible_rect_tiles_; |
362 bool has_skewport_rect_tiles_; | 367 bool has_skewport_rect_tiles_; |
363 bool has_soon_border_rect_tiles_; | 368 bool has_soon_border_rect_tiles_; |
364 bool has_eventually_rect_tiles_; | 369 bool has_eventually_rect_tiles_; |
365 | 370 |
366 Occlusion current_occlusion_in_layer_space_; | 371 Occlusion current_occlusion_in_layer_space_; |
367 | 372 |
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: | 373 private: |
382 DISALLOW_ASSIGN(PictureLayerTiling); | 374 DISALLOW_ASSIGN(PictureLayerTiling); |
383 | 375 |
384 RectExpansionCache expansion_cache_; | 376 RectExpansionCache expansion_cache_; |
385 }; | 377 }; |
386 | 378 |
387 } // namespace cc | 379 } // namespace cc |
388 | 380 |
389 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ | 381 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ |
OLD | NEW |