Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2130)

Side by Side Diff: cc/resources/picture_layer_tiling.h

Issue 820703002: c:: Give the raster source to the PictureLayerTilings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 17 matching lines...) Expand all
28 28
29 namespace cc { 29 namespace cc {
30 30
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(float contents_scale,
39 PictureLayerTiling* tiling, 39 const gfx::Rect& content_rect) = 0;
40 const gfx::Rect& content_rect) = 0;
41 virtual gfx::Size CalculateTileSize( 40 virtual gfx::Size CalculateTileSize(
42 const gfx::Size& content_bounds) const = 0; 41 const gfx::Size& content_bounds) const = 0;
43 // This invalidation region defines the area (if any, it can by null) that 42 // This invalidation region defines the area (if any, it can by null) that
44 // tiles can not be shared between pending and active trees. 43 // tiles can not be shared between pending and active trees.
45 virtual const Region* GetPendingInvalidation() = 0; 44 virtual const Region* GetPendingInvalidation() = 0;
46 virtual const PictureLayerTiling* GetPendingOrActiveTwinTiling( 45 virtual const PictureLayerTiling* GetPendingOrActiveTwinTiling(
47 const PictureLayerTiling* tiling) const = 0; 46 const PictureLayerTiling* tiling) const = 0;
48 virtual PictureLayerTiling* GetRecycledTwinTiling( 47 virtual PictureLayerTiling* GetRecycledTwinTiling(
49 const PictureLayerTiling* tiling) = 0; 48 const PictureLayerTiling* tiling) = 0;
50 virtual TilePriority::PriorityBin GetMaxTilePriorityBin() const = 0; 49 virtual TilePriority::PriorityBin GetMaxTilePriorityBin() const = 0;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 100
102 Phase phase_; 101 Phase phase_;
103 102
104 Tile* current_tile_; 103 Tile* current_tile_;
105 TilingData::Iterator visible_iterator_; 104 TilingData::Iterator visible_iterator_;
106 TilingData::SpiralDifferenceIterator spiral_iterator_; 105 TilingData::SpiralDifferenceIterator spiral_iterator_;
107 }; 106 };
108 107
109 ~PictureLayerTiling(); 108 ~PictureLayerTiling();
110 109
111 // Create a tiling with no tiles. CreateTiles must be called to add some. 110 // Create a tiling with no tiles. CreateTile() must be called to add some.
112 // TODO(danakj): Pass the raster_source here instead of the size, store the
113 // raster source instead of layer bounds?
114 static scoped_ptr<PictureLayerTiling> Create( 111 static scoped_ptr<PictureLayerTiling> Create(
115 float contents_scale, 112 float contents_scale,
116 const gfx::Size& layer_bounds, 113 scoped_refptr<RasterSource> raster_source,
117 PictureLayerTilingClient* client, 114 PictureLayerTilingClient* client,
118 size_t max_tiles_for_interest_area, 115 size_t max_tiles_for_interest_area,
119 float skewport_target_time_in_seconds, 116 float skewport_target_time_in_seconds,
120 int skewport_extrapolation_limit_in_content_pixels); 117 int skewport_extrapolation_limit_in_content_pixels);
121 118
122 gfx::Size layer_bounds() const { return layer_bounds_; } 119 RasterSource* raster_source() const { return raster_source_.get(); }
123 void Resize(const gfx::Size& new_layer_bounds); 120
121 void SetRasterSourceAndResize(scoped_refptr<RasterSource> raster_source);
124 void Invalidate(const Region& layer_invalidation); 122 void Invalidate(const Region& layer_invalidation);
125 void SetRasterSource(scoped_refptr<RasterSource> raster_source); 123 void SetRasterSourceOnTiles();
126 void CreateMissingTilesInLiveTilesRect(); 124 void CreateMissingTilesInLiveTilesRect();
127 125
128 void CloneTilesAndPropertiesFrom(const PictureLayerTiling& twin_tiling); 126 void CloneTilesAndPropertiesFrom(const PictureLayerTiling& twin_tiling);
129 127
130 void set_resolution(TileResolution resolution) { resolution_ = resolution; } 128 void set_resolution(TileResolution resolution) { resolution_ = resolution; }
131 TileResolution resolution() const { return resolution_; } 129 TileResolution resolution() const { return resolution_; }
132 void set_can_require_tiles_for_activation(bool can_require_tiles) { 130 void set_can_require_tiles_for_activation(bool can_require_tiles) {
133 can_require_tiles_for_activation_ = can_require_tiles; 131 can_require_tiles_for_activation_ = can_require_tiles;
134 } 132 }
135 133
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 265
268 protected: 266 protected:
269 friend class CoverageIterator; 267 friend class CoverageIterator;
270 friend class TilingRasterTileIterator; 268 friend class TilingRasterTileIterator;
271 friend class TilingSetEvictionQueue; 269 friend class TilingSetEvictionQueue;
272 270
273 typedef std::pair<int, int> TileMapKey; 271 typedef std::pair<int, int> TileMapKey;
274 typedef base::hash_map<TileMapKey, scoped_refptr<Tile>> TileMap; 272 typedef base::hash_map<TileMapKey, scoped_refptr<Tile>> TileMap;
275 273
276 PictureLayerTiling(float contents_scale, 274 PictureLayerTiling(float contents_scale,
277 const gfx::Size& layer_bounds, 275 scoped_refptr<RasterSource> raster_source,
278 PictureLayerTilingClient* client, 276 PictureLayerTilingClient* client,
279 size_t max_tiles_for_interest_area, 277 size_t max_tiles_for_interest_area,
280 float skewport_target_time_in_seconds, 278 float skewport_target_time_in_seconds,
281 int skewport_extrapolation_limit_in_content_pixels); 279 int skewport_extrapolation_limit_in_content_pixels);
282 void SetLiveTilesRect(const gfx::Rect& live_tiles_rect); 280 void SetLiveTilesRect(const gfx::Rect& live_tiles_rect);
283 void VerifyLiveTilesRect(bool is_on_recycle_tree) const; 281 void VerifyLiveTilesRect(bool is_on_recycle_tree) const;
284 Tile* CreateTile(int i, 282 Tile* CreateTile(int i,
285 int j, 283 int j,
286 const PictureLayerTiling* twin_tiling, 284 const PictureLayerTiling* twin_tiling,
287 PictureLayerTiling* recycled_twin); 285 PictureLayerTiling* recycled_twin);
(...skipping 25 matching lines...) Expand all
313 viewport_in_layer_space != last_viewport_in_layer_space_; 311 viewport_in_layer_space != last_viewport_in_layer_space_;
314 } 312 }
315 313
316 const size_t max_tiles_for_interest_area_; 314 const size_t max_tiles_for_interest_area_;
317 const float skewport_target_time_in_seconds_; 315 const float skewport_target_time_in_seconds_;
318 const int skewport_extrapolation_limit_in_content_pixels_; 316 const int skewport_extrapolation_limit_in_content_pixels_;
319 317
320 // Given properties. 318 // Given properties.
321 const float contents_scale_; 319 const float contents_scale_;
322 PictureLayerTilingClient* const client_; 320 PictureLayerTilingClient* const client_;
323 gfx::Size layer_bounds_; 321 scoped_refptr<RasterSource> raster_source_;
324 TileResolution resolution_; 322 TileResolution resolution_;
325 323
326 // Internal data. 324 // Internal data.
327 TilingData tiling_data_; 325 TilingData tiling_data_;
328 TileMap tiles_; // It is not legal to have a NULL tile in the tiles_ map. 326 TileMap tiles_; // It is not legal to have a NULL tile in the tiles_ map.
329 gfx::Rect live_tiles_rect_; 327 gfx::Rect live_tiles_rect_;
330 328
331 // State saved for computing velocities based upon finite differences. 329 // State saved for computing velocities based upon finite differences.
332 double last_impl_frame_time_in_seconds_; 330 double last_impl_frame_time_in_seconds_;
333 gfx::Rect last_viewport_in_layer_space_; 331 gfx::Rect last_viewport_in_layer_space_;
(...skipping 17 matching lines...) Expand all
351 349
352 private: 350 private:
353 DISALLOW_ASSIGN(PictureLayerTiling); 351 DISALLOW_ASSIGN(PictureLayerTiling);
354 352
355 RectExpansionCache expansion_cache_; 353 RectExpansionCache expansion_cache_;
356 }; 354 };
357 355
358 } // namespace cc 356 } // namespace cc
359 357
360 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ 358 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698