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_TILES_PICTURE_LAYER_TILING_H_ | 5 #ifndef CC_TILES_PICTURE_LAYER_TILING_H_ |
6 #define CC_TILES_PICTURE_LAYER_TILING_H_ | 6 #define CC_TILES_PICTURE_LAYER_TILING_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 18 matching lines...) Expand all Loading... |
29 namespace cc { | 29 namespace cc { |
30 | 30 |
31 class PictureLayerTiling; | 31 class PictureLayerTiling; |
32 class PrioritizedTile; | 32 class PrioritizedTile; |
33 class RasterSource; | 33 class RasterSource; |
34 | 34 |
35 class CC_EXPORT PictureLayerTilingClient { | 35 class CC_EXPORT PictureLayerTilingClient { |
36 public: | 36 public: |
37 // Create a tile at the given content_rect (in the contents scale of the | 37 // Create a tile at the given content_rect (in the contents scale of the |
38 // tiling) This might return null if the client cannot create such a tile. | 38 // tiling) This might return null if the client cannot create such a tile. |
39 virtual ScopedTilePtr CreateTile(float contents_scale, | 39 virtual ScopedTilePtr CreateTile(const Tile::CreateInfo& info) = 0; |
40 const gfx::Rect& content_rect) = 0; | |
41 virtual gfx::Size CalculateTileSize( | 40 virtual gfx::Size CalculateTileSize( |
42 const gfx::Size& content_bounds) const = 0; | 41 const gfx::Size& content_bounds) const = 0; |
43 // This invalidation region defines the area (if any, it can by null) that | 42 // This invalidation region defines the area (if any, it can by null) that |
44 // tiles can not be shared between pending and active trees. | 43 // tiles can not be shared between pending and active trees. |
45 virtual const Region* GetPendingInvalidation() = 0; | 44 virtual const Region* GetPendingInvalidation() = 0; |
46 virtual const PictureLayerTiling* GetPendingOrActiveTwinTiling( | 45 virtual const PictureLayerTiling* GetPendingOrActiveTwinTiling( |
47 const PictureLayerTiling* tiling) const = 0; | 46 const PictureLayerTiling* tiling) const = 0; |
48 virtual bool HasValidTilePriorities() const = 0; | 47 virtual bool HasValidTilePriorities() const = 0; |
49 virtual bool RequiresHighResToDraw() const = 0; | 48 virtual bool RequiresHighResToDraw() const = 0; |
50 | 49 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 | 277 |
279 PictureLayerTiling(WhichTree tree, | 278 PictureLayerTiling(WhichTree tree, |
280 float contents_scale, | 279 float contents_scale, |
281 scoped_refptr<RasterSource> raster_source, | 280 scoped_refptr<RasterSource> raster_source, |
282 PictureLayerTilingClient* client, | 281 PictureLayerTilingClient* client, |
283 size_t tiling_interest_area_padding, | 282 size_t tiling_interest_area_padding, |
284 float skewport_target_time_in_seconds, | 283 float skewport_target_time_in_seconds, |
285 int skewport_extrapolation_limit_in_content_pixels); | 284 int skewport_extrapolation_limit_in_content_pixels); |
286 void SetLiveTilesRect(const gfx::Rect& live_tiles_rect); | 285 void SetLiveTilesRect(const gfx::Rect& live_tiles_rect); |
287 void VerifyLiveTilesRect(bool is_on_recycle_tree) const; | 286 void VerifyLiveTilesRect(bool is_on_recycle_tree) const; |
288 Tile* CreateTile(int i, int j); | 287 Tile* CreateTile(const Tile::CreateInfo& info); |
289 ScopedTilePtr TakeTileAt(int i, int j); | 288 ScopedTilePtr TakeTileAt(int i, int j); |
290 // Returns true if the Tile existed and was removed from the tiling. | 289 // Returns true if the Tile existed and was removed from the tiling. |
291 bool RemoveTileAt(int i, int j); | 290 bool RemoveTileAt(int i, int j); |
292 bool TilingMatchesTileIndices(const PictureLayerTiling* twin) const; | 291 bool TilingMatchesTileIndices(const PictureLayerTiling* twin) const; |
293 | 292 |
294 // Computes a skewport. The calculation extrapolates the last visible | 293 // Computes a skewport. The calculation extrapolates the last visible |
295 // rect and the current visible rect to expand the skewport to where it | 294 // rect and the current visible rect to expand the skewport to where it |
296 // would be in |skewport_target_time| seconds. Note that the skewport | 295 // would be in |skewport_target_time| seconds. Note that the skewport |
297 // is guaranteed to contain the current visible rect. | 296 // is guaranteed to contain the current visible rect. |
298 gfx::Rect ComputeSkewport(double current_frame_time_in_seconds, | 297 gfx::Rect ComputeSkewport(double current_frame_time_in_seconds, |
(...skipping 20 matching lines...) Expand all Loading... |
319 const gfx::Rect& visible_rect_in_content_space) { | 318 const gfx::Rect& visible_rect_in_content_space) { |
320 visible_rect_history_[1] = visible_rect_history_[0]; | 319 visible_rect_history_[1] = visible_rect_history_[0]; |
321 visible_rect_history_[0].frame_time_in_seconds = frame_time_in_seconds; | 320 visible_rect_history_[0].frame_time_in_seconds = frame_time_in_seconds; |
322 visible_rect_history_[0].visible_rect_in_content_space = | 321 visible_rect_history_[0].visible_rect_in_content_space = |
323 visible_rect_in_content_space; | 322 visible_rect_in_content_space; |
324 // If we don't have a second history item, set it to the most recent one. | 323 // If we don't have a second history item, set it to the most recent one. |
325 if (visible_rect_history_[1].frame_time_in_seconds == 0.0) | 324 if (visible_rect_history_[1].frame_time_in_seconds == 0.0) |
326 visible_rect_history_[1] = visible_rect_history_[0]; | 325 visible_rect_history_[1] = visible_rect_history_[0]; |
327 } | 326 } |
328 bool IsTileOccludedOnCurrentTree(const Tile* tile) const; | 327 bool IsTileOccludedOnCurrentTree(const Tile* tile) const; |
329 bool ShouldCreateTileAt(int i, int j) const; | 328 Tile::CreateInfo CreateInfoForTile(int i, int j) const; |
| 329 bool ShouldCreateTileAt(const Tile::CreateInfo& info) const; |
330 bool IsTileOccluded(const Tile* tile) const; | 330 bool IsTileOccluded(const Tile* tile) const; |
331 void UpdateRequiredStatesOnTile(Tile* tile) const; | 331 void UpdateRequiredStatesOnTile(Tile* tile) const; |
332 PrioritizedTile MakePrioritizedTile( | 332 PrioritizedTile MakePrioritizedTile( |
333 Tile* tile, | 333 Tile* tile, |
334 PriorityRectType priority_rect_type) const; | 334 PriorityRectType priority_rect_type) const; |
335 TilePriority ComputePriorityForTile( | 335 TilePriority ComputePriorityForTile( |
336 const Tile* tile, | 336 const Tile* tile, |
337 PriorityRectType priority_rect_type) const; | 337 PriorityRectType priority_rect_type) const; |
338 PriorityRectType ComputePriorityRectTypeForTile(const Tile* tile) const; | 338 PriorityRectType ComputePriorityRectTypeForTile(const Tile* tile) const; |
339 bool has_visible_rect_tiles() const { return has_visible_rect_tiles_; } | 339 bool has_visible_rect_tiles() const { return has_visible_rect_tiles_; } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 bool has_eventually_rect_tiles_; | 406 bool has_eventually_rect_tiles_; |
407 bool all_tiles_done_; | 407 bool all_tiles_done_; |
408 | 408 |
409 private: | 409 private: |
410 DISALLOW_ASSIGN(PictureLayerTiling); | 410 DISALLOW_ASSIGN(PictureLayerTiling); |
411 }; | 411 }; |
412 | 412 |
413 } // namespace cc | 413 } // namespace cc |
414 | 414 |
415 #endif // CC_TILES_PICTURE_LAYER_TILING_H_ | 415 #endif // CC_TILES_PICTURE_LAYER_TILING_H_ |
OLD | NEW |