| 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..e79aa0040fc5e08fe09dabf679cc79d0165b05be 100644
|
| --- a/cc/resources/picture_layer_tiling.h
|
| +++ b/cc/resources/picture_layer_tiling.h
|
| @@ -45,6 +45,55 @@ 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++();
|
| +
|
| + 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);
|
| + };
|
| +
|
| + void UpdateCurrentTilePriority();
|
| +
|
| + PictureLayerTiling* tiling_;
|
| +
|
| + Type type_;
|
| + gfx::Rect visible_rect_in_content_space_;
|
| + gfx::Rect skewport_in_content_space_;
|
| + gfx::Rect eventually_rect_in_content_space_;
|
| + WhichTree tree_;
|
| +
|
| + Tile* current_tile_;
|
| + bool current_tile_priority_updated_;
|
| + TilingData::Iterator visible_iterator_;
|
| + TilingData::SpiralDifferenceIterator spiral_iterator_;
|
| + };
|
| +
|
| ~PictureLayerTiling();
|
|
|
| // Create a tiling with no tiles. CreateTiles must be called to add some.
|
| @@ -69,6 +118,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 +135,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
|
| @@ -183,6 +235,8 @@ class CC_EXPORT PictureLayerTiling {
|
| }
|
|
|
| protected:
|
| + friend class TilingRasterTileIterator;
|
| +
|
| typedef std::pair<int, int> TileMapKey;
|
| typedef base::hash_map<TileMapKey, scoped_refptr<Tile> > TileMap;
|
|
|
| @@ -190,7 +244,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 +267,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_;
|
| + gfx::Rect current_skewport_;
|
| + gfx::Rect current_eventually_rect_;
|
|
|
| friend class CoverageIterator;
|
|
|
|
|