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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 static float CalculateSoonBorderDistance( | 91 static float CalculateSoonBorderDistance( |
92 const gfx::Rect& visible_rect_in_content_space, | 92 const gfx::Rect& visible_rect_in_content_space, |
93 float content_to_screen_scale); | 93 float content_to_screen_scale); |
94 | 94 |
95 // Create a tiling with no tiles. CreateTile() must be called to add some. | 95 // Create a tiling with no tiles. CreateTile() must be called to add some. |
96 static scoped_ptr<PictureLayerTiling> Create( | 96 static scoped_ptr<PictureLayerTiling> Create( |
97 WhichTree tree, | 97 WhichTree tree, |
98 float contents_scale, | 98 float contents_scale, |
99 scoped_refptr<RasterSource> raster_source, | 99 scoped_refptr<RasterSource> raster_source, |
100 PictureLayerTilingClient* client, | 100 PictureLayerTilingClient* client, |
101 size_t max_tiles_for_interest_area, | 101 size_t tiling_interest_area_padding, |
102 float skewport_target_time_in_seconds, | 102 float skewport_target_time_in_seconds, |
103 int skewport_extrapolation_limit_in_content_pixels); | 103 int skewport_extrapolation_limit_in_content_pixels); |
104 | 104 |
105 void SetRasterSourceAndResize(scoped_refptr<RasterSource> raster_source); | 105 void SetRasterSourceAndResize(scoped_refptr<RasterSource> raster_source); |
106 void Invalidate(const Region& layer_invalidation); | 106 void Invalidate(const Region& layer_invalidation); |
107 void CreateMissingTilesInLiveTilesRect(); | 107 void CreateMissingTilesInLiveTilesRect(); |
108 void TakeTilesAndPropertiesFrom(PictureLayerTiling* pending_twin, | 108 void TakeTilesAndPropertiesFrom(PictureLayerTiling* pending_twin, |
109 const Region& layer_invalidation); | 109 const Region& layer_invalidation); |
110 | 110 |
111 bool IsTileRequiredForActivation(const Tile* tile) const; | 111 bool IsTileRequiredForActivation(const Tile* tile) const; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 bool ComputeTilePriorityRects(const gfx::Rect& viewport_in_layer_space, | 233 bool ComputeTilePriorityRects(const gfx::Rect& viewport_in_layer_space, |
234 float ideal_contents_scale, | 234 float ideal_contents_scale, |
235 double current_frame_time_in_seconds, | 235 double current_frame_time_in_seconds, |
236 const Occlusion& occlusion_in_layer_space); | 236 const Occlusion& occlusion_in_layer_space); |
237 | 237 |
238 void GetAllPrioritizedTilesForTracing( | 238 void GetAllPrioritizedTilesForTracing( |
239 std::vector<PrioritizedTile>* prioritized_tiles) const; | 239 std::vector<PrioritizedTile>* prioritized_tiles) const; |
240 void AsValueInto(base::trace_event::TracedValue* array) const; | 240 void AsValueInto(base::trace_event::TracedValue* array) const; |
241 size_t GPUMemoryUsageInBytes() const; | 241 size_t GPUMemoryUsageInBytes() const; |
242 | 242 |
243 struct RectExpansionCache { | |
244 RectExpansionCache(); | |
245 | |
246 gfx::Rect previous_start; | |
247 gfx::Rect previous_bounds; | |
248 gfx::Rect previous_result; | |
249 int64 previous_target; | |
250 }; | |
251 | |
252 static | |
253 gfx::Rect ExpandRectEquallyToAreaBoundedBy( | |
254 const gfx::Rect& starting_rect, | |
255 int64 target_area, | |
256 const gfx::Rect& bounding_rect, | |
257 RectExpansionCache* cache); | |
258 | |
259 protected: | 243 protected: |
260 friend class CoverageIterator; | 244 friend class CoverageIterator; |
261 friend class PrioritizedTile; | 245 friend class PrioritizedTile; |
262 friend class TilingSetRasterQueueAll; | 246 friend class TilingSetRasterQueueAll; |
263 friend class TilingSetRasterQueueRequired; | 247 friend class TilingSetRasterQueueRequired; |
264 friend class TilingSetEvictionQueue; | 248 friend class TilingSetEvictionQueue; |
265 | 249 |
266 // PENDING VISIBLE RECT refers to the visible rect that will become current | 250 // PENDING VISIBLE RECT refers to the visible rect that will become current |
267 // upon activation (ie, the pending tree's visible rect). Tiles in this | 251 // upon activation (ie, the pending tree's visible rect). Tiles in this |
268 // region that are not part of the current visible rect are all handled | 252 // region that are not part of the current visible rect are all handled |
(...skipping 11 matching lines...) Expand all Loading... |
280 | 264 |
281 struct FrameVisibleRect { | 265 struct FrameVisibleRect { |
282 gfx::Rect visible_rect_in_content_space; | 266 gfx::Rect visible_rect_in_content_space; |
283 double frame_time_in_seconds = 0.0; | 267 double frame_time_in_seconds = 0.0; |
284 }; | 268 }; |
285 | 269 |
286 PictureLayerTiling(WhichTree tree, | 270 PictureLayerTiling(WhichTree tree, |
287 float contents_scale, | 271 float contents_scale, |
288 scoped_refptr<RasterSource> raster_source, | 272 scoped_refptr<RasterSource> raster_source, |
289 PictureLayerTilingClient* client, | 273 PictureLayerTilingClient* client, |
290 size_t max_tiles_for_interest_area, | 274 size_t tiling_interest_area_padding, |
291 float skewport_target_time_in_seconds, | 275 float skewport_target_time_in_seconds, |
292 int skewport_extrapolation_limit_in_content_pixels); | 276 int skewport_extrapolation_limit_in_content_pixels); |
293 void SetLiveTilesRect(const gfx::Rect& live_tiles_rect); | 277 void SetLiveTilesRect(const gfx::Rect& live_tiles_rect); |
294 void VerifyLiveTilesRect(bool is_on_recycle_tree) const; | 278 void VerifyLiveTilesRect(bool is_on_recycle_tree) const; |
295 Tile* CreateTile(int i, int j); | 279 Tile* CreateTile(int i, int j); |
296 ScopedTilePtr TakeTileAt(int i, int j); | 280 ScopedTilePtr TakeTileAt(int i, int j); |
297 // Returns true if the Tile existed and was removed from the tiling. | 281 // Returns true if the Tile existed and was removed from the tiling. |
298 bool RemoveTileAt(int i, int j); | 282 bool RemoveTileAt(int i, int j); |
299 bool TilingMatchesTileIndices(const PictureLayerTiling* twin) const; | 283 bool TilingMatchesTileIndices(const PictureLayerTiling* twin) const; |
300 | 284 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 return current_soon_border_rect_; | 352 return current_soon_border_rect_; |
369 } | 353 } |
370 const gfx::Rect& current_eventually_rect() const { | 354 const gfx::Rect& current_eventually_rect() const { |
371 return current_eventually_rect_; | 355 return current_eventually_rect_; |
372 } | 356 } |
373 bool has_ever_been_updated() const { | 357 bool has_ever_been_updated() const { |
374 return visible_rect_history_[0].frame_time_in_seconds != 0.0; | 358 return visible_rect_history_[0].frame_time_in_seconds != 0.0; |
375 } | 359 } |
376 void RemoveTilesInRegion(const Region& layer_region, bool recreate_tiles); | 360 void RemoveTilesInRegion(const Region& layer_region, bool recreate_tiles); |
377 | 361 |
378 const size_t max_tiles_for_interest_area_; | 362 const size_t tiling_interest_area_padding_; |
379 const float skewport_target_time_in_seconds_; | 363 const float skewport_target_time_in_seconds_; |
380 const int skewport_extrapolation_limit_in_content_pixels_; | 364 const int skewport_extrapolation_limit_in_content_pixels_; |
381 | 365 |
382 // Given properties. | 366 // Given properties. |
383 const float contents_scale_; | 367 const float contents_scale_; |
384 PictureLayerTilingClient* const client_; | 368 PictureLayerTilingClient* const client_; |
385 const WhichTree tree_; | 369 const WhichTree tree_; |
386 scoped_refptr<RasterSource> raster_source_; | 370 scoped_refptr<RasterSource> raster_source_; |
387 TileResolution resolution_; | 371 TileResolution resolution_; |
388 | 372 |
(...skipping 18 matching lines...) Expand all Loading... |
407 Occlusion current_occlusion_in_layer_space_; | 391 Occlusion current_occlusion_in_layer_space_; |
408 | 392 |
409 bool has_visible_rect_tiles_; | 393 bool has_visible_rect_tiles_; |
410 bool has_skewport_rect_tiles_; | 394 bool has_skewport_rect_tiles_; |
411 bool has_soon_border_rect_tiles_; | 395 bool has_soon_border_rect_tiles_; |
412 bool has_eventually_rect_tiles_; | 396 bool has_eventually_rect_tiles_; |
413 bool all_tiles_done_; | 397 bool all_tiles_done_; |
414 | 398 |
415 private: | 399 private: |
416 DISALLOW_ASSIGN(PictureLayerTiling); | 400 DISALLOW_ASSIGN(PictureLayerTiling); |
417 | |
418 RectExpansionCache expansion_cache_; | |
419 }; | 401 }; |
420 | 402 |
421 } // namespace cc | 403 } // namespace cc |
422 | 404 |
423 #endif // CC_TILES_PICTURE_LAYER_TILING_H_ | 405 #endif // CC_TILES_PICTURE_LAYER_TILING_H_ |
OLD | NEW |