Chromium Code Reviews| Index: cc/resources/picture_layer_tiling.h |
| diff --git a/cc/resources/picture_layer_tiling.h b/cc/resources/picture_layer_tiling.h |
| index 5a83e40696f99e78870386ed1a18a85887b42e45..d53616ff59d7494cb9e80d06d43a2f0a1d950f0a 100644 |
| --- a/cc/resources/picture_layer_tiling.h |
| +++ b/cc/resources/picture_layer_tiling.h |
| @@ -32,8 +32,10 @@ class PictureLayerTilingClient { |
| gfx::Rect content_rect) = 0; |
| virtual void UpdatePile(Tile* tile) = 0; |
| virtual gfx::Size CalculateTileSize( |
| - gfx::Size current_tile_size, |
| gfx::Size content_bounds) = 0; |
| + virtual const Region* GetInvalidation() = 0; |
| + virtual const PictureLayerTiling* GetTwinTiling( |
| + const PictureLayerTiling* tiling) = 0; |
| protected: |
| virtual ~PictureLayerTilingClient() {} |
| @@ -44,17 +46,17 @@ class CC_EXPORT PictureLayerTiling { |
| ~PictureLayerTiling(); |
| // Create a tiling with no tiles. CreateTiles must be called to add some. |
| - static scoped_ptr<PictureLayerTiling> Create(float contents_scale); |
| - scoped_ptr<PictureLayerTiling> Clone() const; |
| - |
| + static scoped_ptr<PictureLayerTiling> Create( |
| + float contents_scale, |
| + gfx::Size layer_bounds, |
| + PictureLayerTilingClient* client); |
| + scoped_ptr<PictureLayerTiling> Clone(gfx::Size layer_bounds, |
| + PictureLayerTilingClient* client) const; |
| gfx::Size layer_bounds() const { return layer_bounds_; } |
| - void SetLayerBounds(gfx::Size layer_bounds); |
| - void Invalidate(const Region& layer_invalidation); |
| void InvalidateTilesWithText(); |
| // Add any tiles that intersect with |layer_rect|. If any tiles already |
| // exist, then this leaves them as-is. |
| - void CreateTilesFromLayerRect(gfx::Rect layer_rect); |
| void SetClient(PictureLayerTilingClient* client); |
| void set_resolution(TileResolution resolution) { resolution_ = resolution; } |
| @@ -64,7 +66,9 @@ class CC_EXPORT PictureLayerTiling { |
| gfx::SizeF ContentSizeF() const; |
| float contents_scale() const { return contents_scale_; } |
| - std::vector<Tile*> AllTilesForTesting() const { |
| + std::vector<Tile*> AllTilesForTesting() { |
| + SetLiveTilesRect(gfx::Rect(tiling_data_.total_size())); |
| + |
| std::vector<Tile*> all_tiles; |
| for (TileMap::const_iterator it = tiles_.begin(); |
| it != tiles_.end(); ++it) |
| @@ -72,11 +76,6 @@ class CC_EXPORT PictureLayerTiling { |
| return all_tiles; |
| } |
| - static gfx::Rect ExpandRectEquallyToAreaBoundedBy( |
| - gfx::Rect starting_rect, |
| - int64 target_area, |
| - gfx::Rect bounding_rect); |
| - |
| // Iterate over all tiles to fill content_rect. Even if tiles are invalid |
| // (i.e. no valid resource) this tiling should still iterate over them. |
| // The union of all geometry_rect calls for each element iterated over should |
| @@ -125,7 +124,7 @@ class CC_EXPORT PictureLayerTiling { |
| Region OpaqueRegionInContentRect(const gfx::Rect&) const; |
| - void Reset() { return tiles_.clear(); } |
| + void Reset(); |
| void UpdateTilePriorities( |
| WhichTree tree, |
| @@ -149,23 +148,40 @@ class CC_EXPORT PictureLayerTiling { |
| scoped_ptr<base::Value> AsValue() const; |
| + static gfx::Rect ExpandRectEquallyToAreaBoundedBy( |
| + gfx::Rect starting_rect, |
| + int64 target_area, |
| + gfx::Rect bounding_rect); |
| + |
| + gfx::Size tile_bounds() const { |
| + return tiling_data_.max_texture_size(); |
| + } |
| + |
| + void SetLiveTilesRect(const gfx::Rect& live_tiles_rect); |
|
enne (OOO)
2013/04/10 20:25:30
I don't like making all of these functions public
whunt
2013/04/10 20:52:30
It's not unreasonable to add SetLiveTilesRect to t
|
| + void CreateTile(int i, int j); |
|
enne (OOO)
2013/04/10 20:25:30
This doesn't look like it needs to be exposed.
|
| + const TilingData& tiling_data() const { return tiling_data_; } |
| + Tile* TileAt(int, int) const; |
| + |
| protected: |
| typedef std::pair<int, int> TileMapKey; |
| typedef base::hash_map<TileMapKey, scoped_refptr<Tile> > TileMap; |
| - explicit PictureLayerTiling(float contents_scale); |
| - Tile* TileAt(int, int) const; |
| - void CreateTilesFromContentRect(gfx::Rect layer_rect); |
| - void CreateTile(int i, int j); |
| + PictureLayerTiling(float contents_scale, |
| + gfx::Size layer_bounds, |
| + PictureLayerTilingClient* client); |
| - PictureLayerTilingClient* client_; |
| + // Given properties. |
| float contents_scale_; |
| gfx::Size layer_bounds_; |
| - gfx::Rect last_prioritized_rect_; |
| - // It is not legal to have a NULL tile in the tiles_ map. |
| - TileMap tiles_; |
| - TilingData tiling_data_; |
| TileResolution resolution_; |
| + PictureLayerTilingClient* client_; |
| + |
| + // Internal data. |
| + TilingData tiling_data_; |
| + TileMap tiles_; // It is not legal to have a NULL tile in the tiles_ map. |
| + gfx::Rect live_tiles_rect_; |
| + |
| + // State saved for computing velocities based upon finite differences. |
| int last_source_frame_number_; |
| double last_impl_frame_time_; |