| 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 20 matching lines...) Expand all Loading... |
| 31 class PictureLayerTiling; | 31 class PictureLayerTiling; |
| 32 class RasterSource; | 32 class RasterSource; |
| 33 | 33 |
| 34 class CC_EXPORT PictureLayerTilingClient { | 34 class CC_EXPORT PictureLayerTilingClient { |
| 35 public: | 35 public: |
| 36 // Create a tile at the given content_rect (in the contents scale of the | 36 // Create a tile at the given content_rect (in the contents scale of the |
| 37 // tiling) This might return null if the client cannot create such a tile. | 37 // tiling) This might return null if the client cannot create such a tile. |
| 38 virtual scoped_refptr<Tile> CreateTile( | 38 virtual scoped_refptr<Tile> CreateTile( |
| 39 PictureLayerTiling* tiling, | 39 PictureLayerTiling* tiling, |
| 40 const gfx::Rect& content_rect) = 0; | 40 const gfx::Rect& content_rect) = 0; |
| 41 virtual RasterSource* GetRasterSource() = 0; | |
| 42 virtual gfx::Size CalculateTileSize( | 41 virtual gfx::Size CalculateTileSize( |
| 43 const gfx::Size& content_bounds) const = 0; | 42 const gfx::Size& content_bounds) const = 0; |
| 44 // This invalidation region defines the area (if any, it can by null) that | 43 // This invalidation region defines the area (if any, it can by null) that |
| 45 // tiles can not be shared between pending and active trees. | 44 // tiles can not be shared between pending and active trees. |
| 46 virtual const Region* GetPendingInvalidation() = 0; | 45 virtual const Region* GetPendingInvalidation() = 0; |
| 47 virtual const PictureLayerTiling* GetPendingOrActiveTwinTiling( | 46 virtual const PictureLayerTiling* GetPendingOrActiveTwinTiling( |
| 48 const PictureLayerTiling* tiling) const = 0; | 47 const PictureLayerTiling* tiling) const = 0; |
| 49 virtual PictureLayerTiling* GetRecycledTwinTiling( | 48 virtual PictureLayerTiling* GetRecycledTwinTiling( |
| 50 const PictureLayerTiling* tiling) = 0; | 49 const PictureLayerTiling* tiling) = 0; |
| 51 virtual TilePriority::PriorityBin GetMaxTilePriorityBin() const = 0; | 50 virtual TilePriority::PriorityBin GetMaxTilePriorityBin() const = 0; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 }; | 137 }; |
| 139 | 138 |
| 140 ~PictureLayerTiling(); | 139 ~PictureLayerTiling(); |
| 141 | 140 |
| 142 // Create a tiling with no tiles. CreateTiles must be called to add some. | 141 // Create a tiling with no tiles. CreateTiles must be called to add some. |
| 143 static scoped_ptr<PictureLayerTiling> Create( | 142 static scoped_ptr<PictureLayerTiling> Create( |
| 144 float contents_scale, | 143 float contents_scale, |
| 145 const gfx::Size& layer_bounds, | 144 const gfx::Size& layer_bounds, |
| 146 PictureLayerTilingClient* client); | 145 PictureLayerTilingClient* client); |
| 147 gfx::Size layer_bounds() const { return layer_bounds_; } | 146 gfx::Size layer_bounds() const { return layer_bounds_; } |
| 148 void UpdateTilesToCurrentRasterSource(const Region& layer_invalidation, | 147 void UpdateTilesToCurrentRasterSource(RasterSource* raster_source, |
| 148 const Region& layer_invalidation, |
| 149 const gfx::Size& new_layer_bounds); | 149 const gfx::Size& new_layer_bounds); |
| 150 void CreateMissingTilesInLiveTilesRect(); | 150 void CreateMissingTilesInLiveTilesRect(); |
| 151 void RemoveTilesInRegion(const Region& layer_region); | 151 void RemoveTilesInRegion(const Region& layer_region); |
| 152 | 152 |
| 153 void SetClient(PictureLayerTilingClient* client); | 153 void SetClient(PictureLayerTilingClient* client); |
| 154 void set_resolution(TileResolution resolution) { resolution_ = resolution; } | 154 void set_resolution(TileResolution resolution) { resolution_ = resolution; } |
| 155 TileResolution resolution() const { return resolution_; } | 155 TileResolution resolution() const { return resolution_; } |
| 156 void set_can_require_tiles_for_activation(bool can_require_tiles) { | 156 void set_can_require_tiles_for_activation(bool can_require_tiles) { |
| 157 can_require_tiles_for_activation_ = can_require_tiles; | 157 can_require_tiles_for_activation_ = can_require_tiles; |
| 158 } | 158 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 int left_; | 253 int left_; |
| 254 int top_; | 254 int top_; |
| 255 int right_; | 255 int right_; |
| 256 int bottom_; | 256 int bottom_; |
| 257 | 257 |
| 258 friend class PictureLayerTiling; | 258 friend class PictureLayerTiling; |
| 259 }; | 259 }; |
| 260 | 260 |
| 261 void Reset(); | 261 void Reset(); |
| 262 | 262 |
| 263 void ComputeTilePriorityRects(WhichTree tree, | 263 void ComputeTilePriorityRects(const gfx::Rect& viewport_in_layer_space, |
| 264 const gfx::Rect& viewport_in_layer_space, | |
| 265 float ideal_contents_scale, | 264 float ideal_contents_scale, |
| 266 double current_frame_time_in_seconds, | 265 double current_frame_time_in_seconds, |
| 267 const Occlusion& occlusion_in_layer_space); | 266 const Occlusion& occlusion_in_layer_space); |
| 268 | 267 |
| 269 bool NeedsUpdateForFrameAtTimeAndViewport( | 268 bool NeedsUpdateForFrameAtTimeAndViewport( |
| 270 double frame_time_in_seconds, | 269 double frame_time_in_seconds, |
| 271 const gfx::Rect& viewport_in_layer_space) { | 270 const gfx::Rect& viewport_in_layer_space) { |
| 272 return frame_time_in_seconds != last_impl_frame_time_in_seconds_ || | 271 return frame_time_in_seconds != last_impl_frame_time_in_seconds_ || |
| 273 viewport_in_layer_space != last_viewport_in_layer_space_; | 272 viewport_in_layer_space != last_viewport_in_layer_space_; |
| 274 } | 273 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 | 380 |
| 382 private: | 381 private: |
| 383 DISALLOW_ASSIGN(PictureLayerTiling); | 382 DISALLOW_ASSIGN(PictureLayerTiling); |
| 384 | 383 |
| 385 RectExpansionCache expansion_cache_; | 384 RectExpansionCache expansion_cache_; |
| 386 }; | 385 }; |
| 387 | 386 |
| 388 } // namespace cc | 387 } // namespace cc |
| 389 | 388 |
| 390 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ | 389 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ |
| OLD | NEW |