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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 virtual bool RequiresHighResToDraw() const = 0; | 55 virtual bool RequiresHighResToDraw() const = 0; |
56 | 56 |
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 { | |
66 EVENTUALLY, | |
67 EVENTUALLY_AND_REQUIRED_FOR_ACTIVATION, | |
68 SOON, | |
69 SOON_AND_REQUIRED_FOR_ACTIVATION, | |
70 NOW, | |
71 NOW_AND_REQUIRED_FOR_ACTIVATION | |
72 }; | |
73 | |
74 class CC_EXPORT TilingRasterTileIterator { | 65 class CC_EXPORT TilingRasterTileIterator { |
75 public: | 66 public: |
76 TilingRasterTileIterator(); | 67 TilingRasterTileIterator(); |
77 explicit TilingRasterTileIterator(PictureLayerTiling* tiling); | 68 explicit TilingRasterTileIterator(PictureLayerTiling* tiling); |
78 ~TilingRasterTileIterator(); | 69 ~TilingRasterTileIterator(); |
79 | 70 |
80 operator bool() const { return !!current_tile_; } | 71 operator bool() const { return !!current_tile_; } |
81 const Tile* operator*() const { return current_tile_; } | 72 const Tile* operator*() const { return current_tile_; } |
82 Tile* operator*() { return current_tile_; } | 73 Tile* operator*() { return current_tile_; } |
83 TilePriority::PriorityBin get_type() const { | 74 TilePriority::PriorityBin get_type() const { |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 bool RemoveTileAt(int i, int j, PictureLayerTiling* recycled_twin); | 289 bool RemoveTileAt(int i, int j, PictureLayerTiling* recycled_twin); |
299 | 290 |
300 // Computes a skewport. The calculation extrapolates the last visible | 291 // Computes a skewport. The calculation extrapolates the last visible |
301 // rect and the current visible rect to expand the skewport to where it | 292 // rect and the current visible rect to expand the skewport to where it |
302 // would be in |skewport_target_time| seconds. Note that the skewport | 293 // would be in |skewport_target_time| seconds. Note that the skewport |
303 // is guaranteed to contain the current visible rect. | 294 // is guaranteed to contain the current visible rect. |
304 gfx::Rect ComputeSkewport(double current_frame_time_in_seconds, | 295 gfx::Rect ComputeSkewport(double current_frame_time_in_seconds, |
305 const gfx::Rect& visible_rect_in_content_space) | 296 const gfx::Rect& visible_rect_in_content_space) |
306 const; | 297 const; |
307 | 298 |
308 void UpdateEvictionCacheIfNeeded(TreePriority tree_priority); | |
309 const std::vector<Tile*>* GetEvictionTiles(TreePriority tree_priority, | |
310 EvictionCategory category); | |
311 | |
312 // Save the required data for computing tile priorities later. | 299 // Save the required data for computing tile priorities later. |
313 void UpdateTilePriorityRects(float content_to_screen_scale_, | 300 void UpdateTilePriorityRects(float content_to_screen_scale_, |
314 const gfx::Rect& visible_rect_in_content_space, | 301 const gfx::Rect& visible_rect_in_content_space, |
315 const gfx::Rect& skewport, | 302 const gfx::Rect& skewport, |
316 const gfx::Rect& soon_border_rect, | 303 const gfx::Rect& soon_border_rect, |
317 const gfx::Rect& eventually_rect, | 304 const gfx::Rect& eventually_rect, |
318 const Occlusion& occlusion_in_layer_space); | 305 const Occlusion& occlusion_in_layer_space); |
319 | 306 |
320 void UpdateTileAndTwinPriority(Tile* tile) const; | 307 void UpdateTileAndTwinPriority(Tile* tile) const; |
321 void UpdateTilePriority(Tile* tile) const; | 308 void UpdateTilePriority(Tile* tile) const; |
(...skipping 23 matching lines...) Expand all Loading... |
345 gfx::Rect current_eventually_rect_; | 332 gfx::Rect current_eventually_rect_; |
346 // Other properties used for tile iteration and prioritization. | 333 // Other properties used for tile iteration and prioritization. |
347 float current_content_to_screen_scale_; | 334 float current_content_to_screen_scale_; |
348 Occlusion current_occlusion_in_layer_space_; | 335 Occlusion current_occlusion_in_layer_space_; |
349 | 336 |
350 bool has_visible_rect_tiles_; | 337 bool has_visible_rect_tiles_; |
351 bool has_skewport_rect_tiles_; | 338 bool has_skewport_rect_tiles_; |
352 bool has_soon_border_rect_tiles_; | 339 bool has_soon_border_rect_tiles_; |
353 bool has_eventually_rect_tiles_; | 340 bool has_eventually_rect_tiles_; |
354 | 341 |
355 // TODO(reveman): Remove this in favour of an array of eviction_tiles_ when we | |
356 // change all enums to have a consistent way of getting the count/last | |
357 // element. | |
358 std::vector<Tile*> eviction_tiles_now_; | |
359 std::vector<Tile*> eviction_tiles_now_and_required_for_activation_; | |
360 std::vector<Tile*> eviction_tiles_soon_; | |
361 std::vector<Tile*> eviction_tiles_soon_and_required_for_activation_; | |
362 std::vector<Tile*> eviction_tiles_eventually_; | |
363 std::vector<Tile*> eviction_tiles_eventually_and_required_for_activation_; | |
364 | |
365 bool eviction_tiles_cache_valid_; | |
366 TreePriority eviction_cache_tree_priority_; | |
367 | |
368 private: | 342 private: |
369 DISALLOW_ASSIGN(PictureLayerTiling); | 343 DISALLOW_ASSIGN(PictureLayerTiling); |
370 | 344 |
371 RectExpansionCache expansion_cache_; | 345 RectExpansionCache expansion_cache_; |
372 }; | 346 }; |
373 | 347 |
374 } // namespace cc | 348 } // namespace cc |
375 | 349 |
376 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ | 350 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ |
OLD | NEW |