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 17 matching lines...) Expand all Loading... |
28 // tiling) This might return null if the client cannot create such a tile. | 28 // tiling) This might return null if the client cannot create such a tile. |
29 virtual scoped_refptr<Tile> CreateTile( | 29 virtual scoped_refptr<Tile> CreateTile( |
30 PictureLayerTiling* tiling, | 30 PictureLayerTiling* tiling, |
31 const gfx::Rect& content_rect) = 0; | 31 const gfx::Rect& content_rect) = 0; |
32 virtual void UpdatePile(Tile* tile) = 0; | 32 virtual void UpdatePile(Tile* tile) = 0; |
33 virtual gfx::Size CalculateTileSize( | 33 virtual gfx::Size CalculateTileSize( |
34 const gfx::Size& content_bounds) const = 0; | 34 const gfx::Size& content_bounds) const = 0; |
35 virtual const Region* GetInvalidation() = 0; | 35 virtual const Region* GetInvalidation() = 0; |
36 virtual const PictureLayerTiling* GetTwinTiling( | 36 virtual const PictureLayerTiling* GetTwinTiling( |
37 const PictureLayerTiling* tiling) const = 0; | 37 const PictureLayerTiling* tiling) const = 0; |
| 38 virtual size_t GetMaxTilesForInterestArea() const = 0; |
| 39 virtual float GetSkewportTargetTimeInSeconds() const = 0; |
| 40 virtual int GetSkewportExtrapolationLimitInContentPixels() const = 0; |
38 | 41 |
39 protected: | 42 protected: |
40 virtual ~PictureLayerTilingClient() {} | 43 virtual ~PictureLayerTilingClient() {} |
41 }; | 44 }; |
42 | 45 |
43 class CC_EXPORT PictureLayerTiling { | 46 class CC_EXPORT PictureLayerTiling { |
44 public: | 47 public: |
45 ~PictureLayerTiling(); | 48 ~PictureLayerTiling(); |
46 | 49 |
47 // Create a tiling with no tiles. CreateTiles must be called to add some. | 50 // Create a tiling with no tiles. CreateTiles must be called to add some. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 int right_; | 129 int right_; |
127 int bottom_; | 130 int bottom_; |
128 | 131 |
129 friend class PictureLayerTiling; | 132 friend class PictureLayerTiling; |
130 }; | 133 }; |
131 | 134 |
132 Region OpaqueRegionInContentRect(const gfx::Rect& content_rect) const; | 135 Region OpaqueRegionInContentRect(const gfx::Rect& content_rect) const; |
133 | 136 |
134 void Reset(); | 137 void Reset(); |
135 | 138 |
136 void UpdateTilePriorities( | 139 void UpdateTilePriorities(WhichTree tree, |
137 WhichTree tree, | 140 const gfx::Rect& visible_layer_rect, |
138 const gfx::Size& device_viewport, | 141 float layer_contents_scale, |
139 const gfx::Rect& viewport_in_layer_space, | 142 double current_frame_time_in_seconds); |
140 const gfx::Rect& visible_layer_rect, | |
141 const gfx::Size& last_layer_bounds, | |
142 const gfx::Size& current_layer_bounds, | |
143 float last_layer_contents_scale, | |
144 float current_layer_contents_scale, | |
145 const gfx::Transform& last_screen_transform, | |
146 const gfx::Transform& current_screen_transform, | |
147 double current_frame_time_in_seconds, | |
148 size_t max_tiles_for_interest_area); | |
149 | 143 |
150 // Copies the src_tree priority into the dst_tree priority for all tiles. | 144 // Copies the src_tree priority into the dst_tree priority for all tiles. |
151 // The src_tree priority is reset to the lowest priority possible. This | 145 // The src_tree priority is reset to the lowest priority possible. This |
152 // also updates the pile on each tile to be the current client's pile. | 146 // also updates the pile on each tile to be the current client's pile. |
153 void DidBecomeActive(); | 147 void DidBecomeActive(); |
154 | 148 |
155 // Resets the active priority for all tiles in a tiling, when an active | 149 // Resets the active priority for all tiles in a tiling, when an active |
156 // tiling is becoming recycled. This may include some tiles which are | 150 // tiling is becoming recycled. This may include some tiles which are |
157 // not in the the pending tiling (due to invalidations). This must | 151 // not in the the pending tiling (due to invalidations). This must |
158 // be called before DidBecomeActive, as it resets the active priority | 152 // be called before DidBecomeActive, as it resets the active priority |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 protected: | 185 protected: |
192 typedef std::pair<int, int> TileMapKey; | 186 typedef std::pair<int, int> TileMapKey; |
193 typedef base::hash_map<TileMapKey, scoped_refptr<Tile> > TileMap; | 187 typedef base::hash_map<TileMapKey, scoped_refptr<Tile> > TileMap; |
194 | 188 |
195 PictureLayerTiling(float contents_scale, | 189 PictureLayerTiling(float contents_scale, |
196 const gfx::Size& layer_bounds, | 190 const gfx::Size& layer_bounds, |
197 PictureLayerTilingClient* client); | 191 PictureLayerTilingClient* client); |
198 void SetLiveTilesRect(const gfx::Rect& live_tiles_rect); | 192 void SetLiveTilesRect(const gfx::Rect& live_tiles_rect); |
199 void CreateTile(int i, int j, const PictureLayerTiling* twin_tiling); | 193 void CreateTile(int i, int j, const PictureLayerTiling* twin_tiling); |
200 | 194 |
| 195 // Computes a skewport. The calculation extrapolates the last visible |
| 196 // rect and the current visible rect to expand the skewport to where it |
| 197 // would be in |skewport_target_time| seconds. Note that the skewport |
| 198 // is guaranteed to contain the current visible rect. |
| 199 gfx::Rect ComputeSkewport(double current_frame_time_in_seconds, |
| 200 const gfx::Rect& visible_rect_in_content_space) |
| 201 const; |
| 202 |
201 // Given properties. | 203 // Given properties. |
202 float contents_scale_; | 204 float contents_scale_; |
203 gfx::Size layer_bounds_; | 205 gfx::Size layer_bounds_; |
204 TileResolution resolution_; | 206 TileResolution resolution_; |
205 PictureLayerTilingClient* client_; | 207 PictureLayerTilingClient* client_; |
206 | 208 |
207 // Internal data. | 209 // Internal data. |
208 TilingData tiling_data_; | 210 TilingData tiling_data_; |
209 TileMap tiles_; // It is not legal to have a NULL tile in the tiles_ map. | 211 TileMap tiles_; // It is not legal to have a NULL tile in the tiles_ map. |
210 gfx::Rect live_tiles_rect_; | 212 gfx::Rect live_tiles_rect_; |
211 | 213 |
212 // State saved for computing velocities based upon finite differences. | 214 // State saved for computing velocities based upon finite differences. |
213 double last_impl_frame_time_in_seconds_; | 215 double last_impl_frame_time_in_seconds_; |
| 216 gfx::RectF last_visible_rect_in_content_space_; |
214 | 217 |
215 friend class CoverageIterator; | 218 friend class CoverageIterator; |
216 | 219 |
217 private: | 220 private: |
218 DISALLOW_ASSIGN(PictureLayerTiling); | 221 DISALLOW_ASSIGN(PictureLayerTiling); |
219 | 222 |
220 RectExpansionCache expansion_cache_; | 223 RectExpansionCache expansion_cache_; |
221 }; | 224 }; |
222 | 225 |
223 } // namespace cc | 226 } // namespace cc |
224 | 227 |
225 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ | 228 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ |
OLD | NEW |