Index: cc/resources/picture_layer_tiling.h |
diff --git a/cc/resources/picture_layer_tiling.h b/cc/resources/picture_layer_tiling.h |
index 407a2ad74d0e4cade0e2becaa889fb776e040c5d..1bcdbc2a51a393f7dae0d3c4f1a137e78a86efee 100644 |
--- a/cc/resources/picture_layer_tiling.h |
+++ b/cc/resources/picture_layer_tiling.h |
@@ -45,6 +45,51 @@ class CC_EXPORT PictureLayerTilingClient { |
class CC_EXPORT PictureLayerTiling { |
public: |
+ class CC_EXPORT TilingRasterTileIterator { |
+ public: |
+ enum Type { VISIBLE, SKEWPORT, EVENTUALLY }; |
+ |
+ TilingRasterTileIterator(); |
+ TilingRasterTileIterator(PictureLayerTiling* tiling, WhichTree tree); |
+ ~TilingRasterTileIterator(); |
+ |
+ operator bool() const { |
+ return current_tile_ && TileNeedsRaster(current_tile_); |
+ } |
+ Tile* operator*() { return current_tile_; } |
+ Type get_type() const { return type_; } |
+ |
+ TilingRasterTileIterator& operator++(); |
+ |
+ bool HasVisibleTiles() const { return type_ == VISIBLE; } |
enne (OOO)
2014/03/06 02:30:45
unused?
vmpstr
2014/03/07 18:22:23
Removed.
|
+ |
+ gfx::Rect TileBounds() const { |
+ DCHECK(*this); |
+ if (type_ == VISIBLE) { |
+ return tiling_->tiling_data_.TileBounds(visible_iterator_.index_x(), |
+ visible_iterator_.index_y()); |
+ } |
+ return tiling_->tiling_data_.TileBounds(spiral_iterator_.index_x(), |
+ spiral_iterator_.index_y()); |
+ } |
+ |
+ private: |
+ void AdvancePhase(); |
+ bool TileNeedsRaster(Tile* tile) const { |
+ RasterMode mode = tile->DetermineRasterModeForTree(tree_); |
+ return tile->NeedsRasterForMode(mode); |
+ }; |
+ |
+ PictureLayerTiling* tiling_; |
+ |
+ Type type_; |
+ WhichTree tree_; |
+ |
+ Tile* current_tile_; |
+ TilingData::Iterator visible_iterator_; |
+ TilingData::SpiralDifferenceIterator spiral_iterator_; |
+ }; |
+ |
~PictureLayerTiling(); |
// Create a tiling with no tiles. CreateTiles must be called to add some. |
@@ -69,6 +114,11 @@ class CC_EXPORT PictureLayerTiling { |
gfx::Size tile_size() const { return tiling_data_.max_texture_size(); } |
float contents_scale() const { return contents_scale_; } |
+ Tile* TileAt(int i, int j) const { |
+ TileMap::const_iterator iter = tiles_.find(TileMapKey(i, j)); |
+ return (iter == tiles_.end()) ? NULL : iter->second.get(); |
+ } |
+ |
void CreateAllTilesForTesting() { |
SetLiveTilesRect(gfx::Rect(tiling_data_.total_size())); |
} |
@@ -81,8 +131,6 @@ class CC_EXPORT PictureLayerTiling { |
return all_tiles; |
} |
- Tile* TileAt(int i, int j) const; |
- |
// 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 |
@@ -159,6 +207,8 @@ class CC_EXPORT PictureLayerTiling { |
return frame_time_in_seconds != last_impl_frame_time_in_seconds_; |
} |
+ size_t RequiredGPUMemoryInBytes() const; |
+ |
scoped_ptr<base::Value> AsValue() const; |
size_t GPUMemoryUsageInBytes() const; |
@@ -183,6 +233,9 @@ class CC_EXPORT PictureLayerTiling { |
} |
protected: |
+ friend class TilingRasterTileIterator; |
+ friend class TilingEvictionTileIterator; |
+ |
typedef std::pair<int, int> TileMapKey; |
typedef base::hash_map<TileMapKey, scoped_refptr<Tile> > TileMap; |
@@ -190,7 +243,7 @@ class CC_EXPORT PictureLayerTiling { |
const gfx::Size& layer_bounds, |
PictureLayerTilingClient* client); |
void SetLiveTilesRect(const gfx::Rect& live_tiles_rect); |
- void CreateTile(int i, int j, const PictureLayerTiling* twin_tiling); |
+ Tile* CreateTile(int i, int j, const PictureLayerTiling* twin_tiling); |
// Computes a skewport. The calculation extrapolates the last visible |
// rect and the current visible rect to expand the skewport to where it |
@@ -213,7 +266,11 @@ class CC_EXPORT PictureLayerTiling { |
// State saved for computing velocities based upon finite differences. |
double last_impl_frame_time_in_seconds_; |
- gfx::RectF last_visible_rect_in_content_space_; |
+ gfx::Rect last_visible_rect_in_content_space_; |
+ |
+ gfx::Rect current_visible_rect_in_content_space_; |
enne (OOO)
2014/03/06 02:30:45
I think it'd be cleaner if you just passed them to
vmpstr
2014/03/07 18:22:23
The problem is that these are generated during Upd
enne (OOO)
2014/03/10 21:36:30
Can you get them off the tiling and pass them to t
|
+ gfx::Rect current_skewport_; |
+ gfx::Rect current_eventually_rect_; |
friend class CoverageIterator; |