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 11 matching lines...) Expand all Loading... |
22 | 22 |
23 namespace base { | 23 namespace base { |
24 namespace debug { | 24 namespace debug { |
25 class TracedValue; | 25 class TracedValue; |
26 } | 26 } |
27 } | 27 } |
28 | 28 |
29 namespace cc { | 29 namespace cc { |
30 | 30 |
31 class PictureLayerTiling; | 31 class PictureLayerTiling; |
32 class PicturePileImpl; | 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; | 41 virtual RasterSource* GetRasterSource() = 0; |
42 virtual gfx::Size CalculateTileSize( | 42 virtual gfx::Size CalculateTileSize( |
43 const gfx::Size& content_bounds) const = 0; | 43 const gfx::Size& content_bounds) const = 0; |
44 // This invalidation region defines the area (if any, it can by null) that | 44 // This invalidation region defines the area (if any, it can by null) that |
45 // tiles can not be shared between pending and active trees. | 45 // tiles can not be shared between pending and active trees. |
46 virtual const Region* GetPendingInvalidation() = 0; | 46 virtual const Region* GetPendingInvalidation() = 0; |
47 virtual const PictureLayerTiling* GetPendingOrActiveTwinTiling( | 47 virtual const PictureLayerTiling* GetPendingOrActiveTwinTiling( |
48 const PictureLayerTiling* tiling) const = 0; | 48 const PictureLayerTiling* tiling) const = 0; |
49 virtual PictureLayerTiling* GetRecycledTwinTiling( | 49 virtual PictureLayerTiling* GetRecycledTwinTiling( |
50 const PictureLayerTiling* tiling) = 0; | 50 const PictureLayerTiling* tiling) = 0; |
| 51 virtual TilePriority::PriorityBin GetMaxTilePriorityBin() const = 0; |
51 virtual size_t GetMaxTilesForInterestArea() const = 0; | 52 virtual size_t GetMaxTilesForInterestArea() const = 0; |
52 virtual float GetSkewportTargetTimeInSeconds() const = 0; | 53 virtual float GetSkewportTargetTimeInSeconds() const = 0; |
53 virtual int GetSkewportExtrapolationLimitInContentPixels() const = 0; | 54 virtual int GetSkewportExtrapolationLimitInContentPixels() const = 0; |
54 virtual WhichTree GetTree() const = 0; | 55 virtual WhichTree GetTree() const = 0; |
55 virtual bool RequiresHighResToDraw() const = 0; | 56 virtual bool RequiresHighResToDraw() const = 0; |
56 | 57 |
57 protected: | 58 protected: |
58 virtual ~PictureLayerTilingClient() {} | 59 virtual ~PictureLayerTilingClient() {} |
59 }; | 60 }; |
60 | 61 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 }; | 138 }; |
138 | 139 |
139 ~PictureLayerTiling(); | 140 ~PictureLayerTiling(); |
140 | 141 |
141 // Create a tiling with no tiles. CreateTiles must be called to add some. | 142 // Create a tiling with no tiles. CreateTiles must be called to add some. |
142 static scoped_ptr<PictureLayerTiling> Create( | 143 static scoped_ptr<PictureLayerTiling> Create( |
143 float contents_scale, | 144 float contents_scale, |
144 const gfx::Size& layer_bounds, | 145 const gfx::Size& layer_bounds, |
145 PictureLayerTilingClient* client); | 146 PictureLayerTilingClient* client); |
146 gfx::Size layer_bounds() const { return layer_bounds_; } | 147 gfx::Size layer_bounds() const { return layer_bounds_; } |
147 void UpdateTilesToCurrentPile(const Region& layer_invalidation, | 148 void UpdateTilesToCurrentRasterSource(const Region& layer_invalidation, |
148 const gfx::Size& new_layer_bounds); | 149 const gfx::Size& new_layer_bounds); |
149 void CreateMissingTilesInLiveTilesRect(); | 150 void CreateMissingTilesInLiveTilesRect(); |
150 void RemoveTilesInRegion(const Region& layer_region); | 151 void RemoveTilesInRegion(const Region& layer_region); |
151 | 152 |
152 void SetClient(PictureLayerTilingClient* client); | 153 void SetClient(PictureLayerTilingClient* client); |
153 void set_resolution(TileResolution resolution) { resolution_ = resolution; } | 154 void set_resolution(TileResolution resolution) { resolution_ = resolution; } |
154 TileResolution resolution() const { return resolution_; } | 155 TileResolution resolution() const { return resolution_; } |
155 void set_can_require_tiles_for_activation(bool can_require_tiles) { | 156 void set_can_require_tiles_for_activation(bool can_require_tiles) { |
156 can_require_tiles_for_activation_ = can_require_tiles; | 157 can_require_tiles_for_activation_ = can_require_tiles; |
157 } | 158 } |
158 | 159 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 Occlusion(gfx::Transform(), | 199 Occlusion(gfx::Transform(), |
199 SimpleEnclosedRegion(viewport_in_layer_space), | 200 SimpleEnclosedRegion(viewport_in_layer_space), |
200 SimpleEnclosedRegion(viewport_in_layer_space)); | 201 SimpleEnclosedRegion(viewport_in_layer_space)); |
201 } | 202 } |
202 | 203 |
203 const gfx::Rect& GetCurrentVisibleRectForTesting() const { | 204 const gfx::Rect& GetCurrentVisibleRectForTesting() const { |
204 return current_visible_rect_; | 205 return current_visible_rect_; |
205 } | 206 } |
206 | 207 |
207 bool IsTileOccluded(const Tile* tile) const; | 208 bool IsTileOccluded(const Tile* tile) const; |
208 bool IsTileRequiredForActivation(const Tile* tile) const; | 209 bool IsTileRequiredForActivationIfVisible(const Tile* tile) const; |
| 210 bool IsTileRequiredForDrawIfVisible(const Tile* tile) const; |
209 | 211 |
210 // Iterate over all tiles to fill content_rect. Even if tiles are invalid | 212 // Iterate over all tiles to fill content_rect. Even if tiles are invalid |
211 // (i.e. no valid resource) this tiling should still iterate over them. | 213 // (i.e. no valid resource) this tiling should still iterate over them. |
212 // The union of all geometry_rect calls for each element iterated over should | 214 // The union of all geometry_rect calls for each element iterated over should |
213 // exactly equal content_rect and no two geometry_rects should intersect. | 215 // exactly equal content_rect and no two geometry_rects should intersect. |
214 class CC_EXPORT CoverageIterator { | 216 class CC_EXPORT CoverageIterator { |
215 public: | 217 public: |
216 CoverageIterator(); | 218 CoverageIterator(); |
217 CoverageIterator(const PictureLayerTiling* tiling, | 219 CoverageIterator(const PictureLayerTiling* tiling, |
218 float dest_scale, | 220 float dest_scale, |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 381 |
380 private: | 382 private: |
381 DISALLOW_ASSIGN(PictureLayerTiling); | 383 DISALLOW_ASSIGN(PictureLayerTiling); |
382 | 384 |
383 RectExpansionCache expansion_cache_; | 385 RectExpansionCache expansion_cache_; |
384 }; | 386 }; |
385 | 387 |
386 } // namespace cc | 388 } // namespace cc |
387 | 389 |
388 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ | 390 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ |
OLD | NEW |