| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 bool RemoveTileAt(int i, int j, PictureLayerTiling* recycled_twin); | 287 bool RemoveTileAt(int i, int j, PictureLayerTiling* recycled_twin); |
| 297 | 288 |
| 298 // Computes a skewport. The calculation extrapolates the last visible | 289 // Computes a skewport. The calculation extrapolates the last visible |
| 299 // rect and the current visible rect to expand the skewport to where it | 290 // rect and the current visible rect to expand the skewport to where it |
| 300 // would be in |skewport_target_time| seconds. Note that the skewport | 291 // would be in |skewport_target_time| seconds. Note that the skewport |
| 301 // is guaranteed to contain the current visible rect. | 292 // is guaranteed to contain the current visible rect. |
| 302 gfx::Rect ComputeSkewport(double current_frame_time_in_seconds, | 293 gfx::Rect ComputeSkewport(double current_frame_time_in_seconds, |
| 303 const gfx::Rect& visible_rect_in_content_space) | 294 const gfx::Rect& visible_rect_in_content_space) |
| 304 const; | 295 const; |
| 305 | 296 |
| 306 void UpdateEvictionCacheIfNeeded(TreePriority tree_priority); | |
| 307 const std::vector<Tile*>* GetEvictionTiles(TreePriority tree_priority, | |
| 308 EvictionCategory category); | |
| 309 | |
| 310 void Invalidate(const Region& layer_region); | 297 void Invalidate(const Region& layer_region); |
| 311 | 298 |
| 312 void DoInvalidate(const Region& layer_region, | 299 void DoInvalidate(const Region& layer_region, |
| 313 bool recreate_invalidated_tiles); | 300 bool recreate_invalidated_tiles); |
| 314 | 301 |
| 315 void UpdateTileAndTwinPriority(Tile* tile) const; | 302 void UpdateTileAndTwinPriority(Tile* tile) const; |
| 316 void UpdateTilePriority(Tile* tile) const; | 303 void UpdateTilePriority(Tile* tile) const; |
| 317 | 304 |
| 318 // Given properties. | 305 // Given properties. |
| 319 float contents_scale_; | 306 float contents_scale_; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 340 gfx::Rect current_soon_border_rect_; | 327 gfx::Rect current_soon_border_rect_; |
| 341 gfx::Rect current_eventually_rect_; | 328 gfx::Rect current_eventually_rect_; |
| 342 | 329 |
| 343 bool has_visible_rect_tiles_; | 330 bool has_visible_rect_tiles_; |
| 344 bool has_skewport_rect_tiles_; | 331 bool has_skewport_rect_tiles_; |
| 345 bool has_soon_border_rect_tiles_; | 332 bool has_soon_border_rect_tiles_; |
| 346 bool has_eventually_rect_tiles_; | 333 bool has_eventually_rect_tiles_; |
| 347 | 334 |
| 348 Occlusion current_occlusion_in_layer_space_; | 335 Occlusion current_occlusion_in_layer_space_; |
| 349 | 336 |
| 350 // TODO(reveman): Remove this in favour of an array of eviction_tiles_ when we | |
| 351 // change all enums to have a consistent way of getting the count/last | |
| 352 // element. | |
| 353 std::vector<Tile*> eviction_tiles_now_; | |
| 354 std::vector<Tile*> eviction_tiles_now_and_required_for_activation_; | |
| 355 std::vector<Tile*> eviction_tiles_soon_; | |
| 356 std::vector<Tile*> eviction_tiles_soon_and_required_for_activation_; | |
| 357 std::vector<Tile*> eviction_tiles_eventually_; | |
| 358 std::vector<Tile*> eviction_tiles_eventually_and_required_for_activation_; | |
| 359 | |
| 360 bool eviction_tiles_cache_valid_; | |
| 361 TreePriority eviction_cache_tree_priority_; | |
| 362 | |
| 363 private: | 337 private: |
| 364 DISALLOW_ASSIGN(PictureLayerTiling); | 338 DISALLOW_ASSIGN(PictureLayerTiling); |
| 365 | 339 |
| 366 RectExpansionCache expansion_cache_; | 340 RectExpansionCache expansion_cache_; |
| 367 }; | 341 }; |
| 368 | 342 |
| 369 } // namespace cc | 343 } // namespace cc |
| 370 | 344 |
| 371 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ | 345 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ |
| OLD | NEW |