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 <map> | 8 #include <map> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 static float CalculateSoonBorderDistance( | 64 static float CalculateSoonBorderDistance( |
65 const gfx::Rect& visible_rect_in_content_space, | 65 const gfx::Rect& visible_rect_in_content_space, |
66 float content_to_screen_scale); | 66 float content_to_screen_scale); |
67 | 67 |
68 // Create a tiling with no tiles. CreateTile() must be called to add some. | 68 // Create a tiling with no tiles. CreateTile() must be called to add some. |
69 static scoped_ptr<PictureLayerTiling> Create( | 69 static scoped_ptr<PictureLayerTiling> Create( |
70 float contents_scale, | 70 float contents_scale, |
71 scoped_refptr<RasterSource> raster_source, | 71 scoped_refptr<RasterSource> raster_source, |
72 PictureLayerTilingClient* client, | 72 PictureLayerTilingClient* client, |
73 size_t max_tiles_for_interest_area, | 73 size_t max_interest_area, |
74 float skewport_target_time_in_seconds, | 74 float skewport_target_time_in_seconds, |
75 int skewport_extrapolation_limit_in_content_pixels); | 75 int skewport_extrapolation_limit_in_content_pixels); |
76 | 76 |
77 void SetRasterSourceAndResize(scoped_refptr<RasterSource> raster_source); | 77 void SetRasterSourceAndResize(scoped_refptr<RasterSource> raster_source); |
78 void Invalidate(const Region& layer_invalidation); | 78 void Invalidate(const Region& layer_invalidation); |
79 void SetRasterSourceOnTiles(); | 79 void SetRasterSourceOnTiles(); |
80 void CreateMissingTilesInLiveTilesRect(); | 80 void CreateMissingTilesInLiveTilesRect(); |
81 void TakeTilesAndPropertiesFrom(PictureLayerTiling* pending_twin, | 81 void TakeTilesAndPropertiesFrom(PictureLayerTiling* pending_twin, |
82 const Region& layer_invalidation); | 82 const Region& layer_invalidation); |
83 | 83 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 typedef base::hash_map<TileMapKey, scoped_refptr<Tile>> TileMap; | 221 typedef base::hash_map<TileMapKey, scoped_refptr<Tile>> TileMap; |
222 | 222 |
223 struct FrameVisibleRect { | 223 struct FrameVisibleRect { |
224 gfx::Rect visible_rect_in_content_space; | 224 gfx::Rect visible_rect_in_content_space; |
225 double frame_time_in_seconds = 0.0; | 225 double frame_time_in_seconds = 0.0; |
226 }; | 226 }; |
227 | 227 |
228 PictureLayerTiling(float contents_scale, | 228 PictureLayerTiling(float contents_scale, |
229 scoped_refptr<RasterSource> raster_source, | 229 scoped_refptr<RasterSource> raster_source, |
230 PictureLayerTilingClient* client, | 230 PictureLayerTilingClient* client, |
231 size_t max_tiles_for_interest_area, | 231 size_t max_interest_area, |
232 float skewport_target_time_in_seconds, | 232 float skewport_target_time_in_seconds, |
233 int skewport_extrapolation_limit_in_content_pixels); | 233 int skewport_extrapolation_limit_in_content_pixels); |
234 void SetLiveTilesRect(const gfx::Rect& live_tiles_rect); | 234 void SetLiveTilesRect(const gfx::Rect& live_tiles_rect); |
235 void VerifyLiveTilesRect(bool is_on_recycle_tree) const; | 235 void VerifyLiveTilesRect(bool is_on_recycle_tree) const; |
236 Tile* CreateTile(int i, int j); | 236 Tile* CreateTile(int i, int j); |
237 // Returns true if the Tile existed and was removed from the tiling. | 237 // Returns true if the Tile existed and was removed from the tiling. |
238 bool RemoveTileAt(int i, int j); | 238 bool RemoveTileAt(int i, int j); |
239 bool TilingMatchesTileIndices(const PictureLayerTiling* twin) const; | 239 bool TilingMatchesTileIndices(const PictureLayerTiling* twin) const; |
240 | 240 |
241 // Computes a skewport. The calculation extrapolates the last visible | 241 // Computes a skewport. The calculation extrapolates the last visible |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 return current_soon_border_rect_; | 303 return current_soon_border_rect_; |
304 } | 304 } |
305 const gfx::Rect& current_eventually_rect() const { | 305 const gfx::Rect& current_eventually_rect() const { |
306 return current_eventually_rect_; | 306 return current_eventually_rect_; |
307 } | 307 } |
308 bool has_ever_been_updated() const { | 308 bool has_ever_been_updated() const { |
309 return visible_rect_history_[0].frame_time_in_seconds != 0.0; | 309 return visible_rect_history_[0].frame_time_in_seconds != 0.0; |
310 } | 310 } |
311 void RemoveTilesInRegion(const Region& layer_region, bool recreate_tiles); | 311 void RemoveTilesInRegion(const Region& layer_region, bool recreate_tiles); |
312 | 312 |
313 const size_t max_tiles_for_interest_area_; | 313 const size_t max_interest_area_; |
314 const float skewport_target_time_in_seconds_; | 314 const float skewport_target_time_in_seconds_; |
315 const int skewport_extrapolation_limit_in_content_pixels_; | 315 const int skewport_extrapolation_limit_in_content_pixels_; |
316 | 316 |
317 // Given properties. | 317 // Given properties. |
318 const float contents_scale_; | 318 const float contents_scale_; |
319 PictureLayerTilingClient* const client_; | 319 PictureLayerTilingClient* const client_; |
320 scoped_refptr<RasterSource> raster_source_; | 320 scoped_refptr<RasterSource> raster_source_; |
321 TileResolution resolution_; | 321 TileResolution resolution_; |
322 | 322 |
323 // Internal data. | 323 // Internal data. |
(...skipping 23 matching lines...) Expand all Loading... |
347 | 347 |
348 private: | 348 private: |
349 DISALLOW_ASSIGN(PictureLayerTiling); | 349 DISALLOW_ASSIGN(PictureLayerTiling); |
350 | 350 |
351 RectExpansionCache expansion_cache_; | 351 RectExpansionCache expansion_cache_; |
352 }; | 352 }; |
353 | 353 |
354 } // namespace cc | 354 } // namespace cc |
355 | 355 |
356 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ | 356 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ |
OLD | NEW |