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

Unified Diff: cc/resources/picture_layer_tiling.h

Issue 12865017: Makes tile-creation lazy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressing last round of feedback Created 7 years, 8 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/picture_layer_impl_unittest.cc ('k') | cc/resources/picture_layer_tiling.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..426a76fa7cf20872ae33a8b7879ed88a9b066197 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,6 +66,10 @@ class CC_EXPORT PictureLayerTiling {
gfx::SizeF ContentSizeF() const;
float contents_scale() const { return contents_scale_; }
+ void CreateAllTilesForTesting() {
+ SetLiveTilesRect(gfx::Rect(tiling_data_.total_size()));
+ }
+
std::vector<Tile*> AllTilesForTesting() const {
std::vector<Tile*> all_tiles;
for (TileMap::const_iterator it = tiles_.begin();
@@ -72,11 +78,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 +126,7 @@ class CC_EXPORT PictureLayerTiling {
Region OpaqueRegionInContentRect(const gfx::Rect&) const;
- void Reset() { return tiles_.clear(); }
+ void Reset();
void UpdateTilePriorities(
WhichTree tree,
@@ -149,23 +150,34 @@ 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);
+
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);
+ PictureLayerTiling(float contents_scale,
+ gfx::Size layer_bounds,
+ PictureLayerTilingClient* client);
+ void SetLiveTilesRect(gfx::Rect live_tiles_rect);
void CreateTile(int i, int j);
+ Tile* TileAt(int, int) const;
- 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_;
« no previous file with comments | « cc/layers/picture_layer_impl_unittest.cc ('k') | cc/resources/picture_layer_tiling.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698