| 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 <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 }; | 120 }; |
| 121 | 121 |
| 122 ~PictureLayerTiling(); | 122 ~PictureLayerTiling(); |
| 123 | 123 |
| 124 // Create a tiling with no tiles. CreateTiles must be called to add some. | 124 // Create a tiling with no tiles. CreateTiles must be called to add some. |
| 125 static scoped_ptr<PictureLayerTiling> Create( | 125 static scoped_ptr<PictureLayerTiling> Create( |
| 126 float contents_scale, | 126 float contents_scale, |
| 127 const gfx::Size& layer_bounds, | 127 const gfx::Size& layer_bounds, |
| 128 PictureLayerTilingClient* client); | 128 PictureLayerTilingClient* client); |
| 129 gfx::Size layer_bounds() const { return layer_bounds_; } | 129 gfx::Size layer_bounds() const { return layer_bounds_; } |
| 130 void SetLayerBounds(const gfx::Size& layer_bounds); | 130 void UpdateTilesToCurrentPile(const Region& layer_invalidation, |
| 131 void Invalidate(const Region& layer_region); | 131 const gfx::Size& new_layer_bounds); |
| 132 void RemoveTilesInRegion(const Region& layer_region); | |
| 133 void CreateMissingTilesInLiveTilesRect(); | 132 void CreateMissingTilesInLiveTilesRect(); |
| 134 | 133 |
| 135 void SetClient(PictureLayerTilingClient* client); | 134 void SetClient(PictureLayerTilingClient* client); |
| 136 void set_resolution(TileResolution resolution) { resolution_ = resolution; } | 135 void set_resolution(TileResolution resolution) { resolution_ = resolution; } |
| 137 TileResolution resolution() const { return resolution_; } | 136 TileResolution resolution() const { return resolution_; } |
| 138 | 137 |
| 139 gfx::Rect TilingRect() const; | 138 gfx::Rect TilingRect() const; |
| 140 gfx::Rect live_tiles_rect() const { return live_tiles_rect_; } | 139 gfx::Rect live_tiles_rect() const { return live_tiles_rect_; } |
| 141 gfx::Size tile_size() const { return tiling_data_.max_texture_size(); } | 140 gfx::Size tile_size() const { return tiling_data_.max_texture_size(); } |
| 142 float contents_scale() const { return contents_scale_; } | 141 float contents_scale() const { return contents_scale_; } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 // also updates the pile on each tile to be the current client's pile. | 222 // also updates the pile on each tile to be the current client's pile. |
| 224 void DidBecomeActive(); | 223 void DidBecomeActive(); |
| 225 | 224 |
| 226 // Resets the active priority for all tiles in a tiling, when an active | 225 // Resets the active priority for all tiles in a tiling, when an active |
| 227 // tiling is becoming recycled. This may include some tiles which are | 226 // tiling is becoming recycled. This may include some tiles which are |
| 228 // not in the the pending tiling (due to invalidations). This must | 227 // not in the the pending tiling (due to invalidations). This must |
| 229 // be called before DidBecomeActive, as it resets the active priority | 228 // be called before DidBecomeActive, as it resets the active priority |
| 230 // while DidBecomeActive promotes pending priority on a similar set of tiles. | 229 // while DidBecomeActive promotes pending priority on a similar set of tiles. |
| 231 void DidBecomeRecycled(); | 230 void DidBecomeRecycled(); |
| 232 | 231 |
| 233 void UpdateTilesToCurrentPile(); | |
| 234 | |
| 235 bool NeedsUpdateForFrameAtTime(double frame_time_in_seconds) { | 232 bool NeedsUpdateForFrameAtTime(double frame_time_in_seconds) { |
| 236 return frame_time_in_seconds != last_impl_frame_time_in_seconds_; | 233 return frame_time_in_seconds != last_impl_frame_time_in_seconds_; |
| 237 } | 234 } |
| 238 | 235 |
| 239 scoped_ptr<base::Value> AsValue() const; | 236 scoped_ptr<base::Value> AsValue() const; |
| 240 size_t GPUMemoryUsageInBytes() const; | 237 size_t GPUMemoryUsageInBytes() const; |
| 241 | 238 |
| 242 struct RectExpansionCache { | 239 struct RectExpansionCache { |
| 243 RectExpansionCache(); | 240 RectExpansionCache(); |
| 244 | 241 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 275 | 272 |
| 276 // Computes a skewport. The calculation extrapolates the last visible | 273 // Computes a skewport. The calculation extrapolates the last visible |
| 277 // rect and the current visible rect to expand the skewport to where it | 274 // rect and the current visible rect to expand the skewport to where it |
| 278 // would be in |skewport_target_time| seconds. Note that the skewport | 275 // would be in |skewport_target_time| seconds. Note that the skewport |
| 279 // is guaranteed to contain the current visible rect. | 276 // is guaranteed to contain the current visible rect. |
| 280 gfx::Rect ComputeSkewport(double current_frame_time_in_seconds, | 277 gfx::Rect ComputeSkewport(double current_frame_time_in_seconds, |
| 281 const gfx::Rect& visible_rect_in_content_space) | 278 const gfx::Rect& visible_rect_in_content_space) |
| 282 const; | 279 const; |
| 283 | 280 |
| 284 void UpdateEvictionCacheIfNeeded(TreePriority tree_priority); | 281 void UpdateEvictionCacheIfNeeded(TreePriority tree_priority); |
| 285 void DoInvalidate(const Region& layer_region, bool recreate_tiles); | 282 void Invalidate(const Region& layer_region); |
| 286 | 283 |
| 287 // Given properties. | 284 // Given properties. |
| 288 float contents_scale_; | 285 float contents_scale_; |
| 289 gfx::Size layer_bounds_; | 286 gfx::Size layer_bounds_; |
| 290 TileResolution resolution_; | 287 TileResolution resolution_; |
| 291 PictureLayerTilingClient* client_; | 288 PictureLayerTilingClient* client_; |
| 292 | 289 |
| 293 // Internal data. | 290 // Internal data. |
| 294 TilingData tiling_data_; | 291 TilingData tiling_data_; |
| 295 TileMap tiles_; // It is not legal to have a NULL tile in the tiles_ map. | 292 TileMap tiles_; // It is not legal to have a NULL tile in the tiles_ map. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 310 | 307 |
| 311 private: | 308 private: |
| 312 DISALLOW_ASSIGN(PictureLayerTiling); | 309 DISALLOW_ASSIGN(PictureLayerTiling); |
| 313 | 310 |
| 314 RectExpansionCache expansion_cache_; | 311 RectExpansionCache expansion_cache_; |
| 315 }; | 312 }; |
| 316 | 313 |
| 317 } // namespace cc | 314 } // namespace cc |
| 318 | 315 |
| 319 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ | 316 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ |
| OLD | NEW |