Index: cc/resources/picture_layer_tiling.h |
diff --git a/cc/resources/picture_layer_tiling.h b/cc/resources/picture_layer_tiling.h |
index 108b922d3dcabf6aec41f9d35fe8563883cd250a..ec4f72e575f2e56e09c5bcb51a03c78a6d9465c0 100644 |
--- a/cc/resources/picture_layer_tiling.h |
+++ b/cc/resources/picture_layer_tiling.h |
@@ -41,6 +41,8 @@ class CC_EXPORT PictureLayerTilingClient { |
virtual size_t GetMaxTilesForInterestArea() const = 0; |
virtual float GetSkewportTargetTimeInSeconds() const = 0; |
virtual int GetSkewportExtrapolationLimitInContentPixels() const = 0; |
+ virtual WhichTree GetTree() const = 0; |
+ virtual bool RequiresHighResToDraw() const = 0; |
protected: |
virtual ~PictureLayerTilingClient() {} |
@@ -73,6 +75,8 @@ class CC_EXPORT PictureLayerTiling { |
private: |
void AdvancePhase(); |
bool TileNeedsRaster(Tile* tile) const { |
+ if (tile->is_occluded()) |
+ return false; |
RasterMode mode = tile->DetermineRasterModeForTree(tree_); |
return tile->NeedsRasterForMode(mode); |
} |
@@ -80,10 +84,6 @@ class CC_EXPORT PictureLayerTiling { |
PictureLayerTiling* tiling_; |
TilePriority::PriorityBin type_; |
- gfx::Rect visible_rect_in_content_space_; |
- gfx::Rect skewport_in_content_space_; |
- gfx::Rect eventually_rect_in_content_space_; |
- gfx::Rect soon_border_rect_in_content_space_; |
WhichTree tree_; |
Tile* current_tile_; |
@@ -129,8 +129,6 @@ class CC_EXPORT PictureLayerTiling { |
gfx::Size layer_bounds() const { return layer_bounds_; } |
void SetLayerBounds(const gfx::Size& layer_bounds); |
void Invalidate(const Region& layer_region); |
- void RemoveTilesInRegion(const Region& layer_region); |
- void CreateMissingTilesInLiveTilesRect(); |
void SetClient(PictureLayerTilingClient* client); |
void set_resolution(TileResolution resolution) { resolution_ = resolution; } |
@@ -146,8 +144,29 @@ class CC_EXPORT PictureLayerTiling { |
return (iter == tiles_.end()) ? NULL : iter->second.get(); |
} |
+ Tile* GetOrCreateTileAt(int i, int j); |
+ |
+ void CreateInterestRectTilesForTesting() { |
+ for (TilingData::Iterator iter(&tiling_data_, live_tiles_rect_, true); iter; |
+ ++iter) { |
+ Tile* tile = GetOrCreateTileAt(iter.index_x(), iter.index_y()); |
+ if (tile) { |
+ UpdateTileOcclusion(tile); |
+ SetTileAndTwinPriority(tile); |
+ } |
+ } |
+ } |
+ |
void CreateAllTilesForTesting() { |
SetLiveTilesRect(tiling_data_.tiling_rect()); |
+ for (TilingData::Iterator iter(&tiling_data_, live_tiles_rect_, true); iter; |
+ ++iter) { |
+ Tile* tile = GetOrCreateTileAt(iter.index_x(), iter.index_y()); |
+ if (tile) { |
+ UpdateTileOcclusion(tile); |
+ SetTileAndTwinPriority(tile); |
+ } |
+ } |
} |
std::vector<Tile*> AllTilesForTesting() const { |
@@ -223,13 +242,6 @@ class CC_EXPORT PictureLayerTiling { |
// also updates the pile on each tile to be the current client's pile. |
void DidBecomeActive(); |
- // Resets the active priority for all tiles in a tiling, when an active |
- // tiling is becoming recycled. This may include some tiles which are |
- // not in the the pending tiling (due to invalidations). This must |
- // be called before DidBecomeActive, as it resets the active priority |
- // while DidBecomeActive promotes pending priority on a similar set of tiles. |
- void DidBecomeRecycled(); |
- |
void UpdateTilesToCurrentPile(); |
bool NeedsUpdateForFrameAtTime(double frame_time_in_seconds) { |
@@ -272,6 +284,8 @@ class CC_EXPORT PictureLayerTiling { |
PictureLayerTilingClient* client); |
void SetLiveTilesRect(const gfx::Rect& live_tiles_rect); |
Tile* CreateTile(int i, int j, const PictureLayerTiling* twin_tiling); |
+ void UpdateTileOcclusion(Tile* tile); |
+ bool IsTileRequiredForActivation(Tile* tile) const; |
// Computes a skewport. The calculation extrapolates the last visible |
// rect and the current visible rect to expand the skewport to where it |
@@ -284,6 +298,9 @@ class CC_EXPORT PictureLayerTiling { |
void UpdateEvictionCacheIfNeeded(TreePriority tree_priority); |
void DoInvalidate(const Region& layer_region, bool recreate_tiles); |
+ void SetTileAndTwinPriority(Tile* tile) const; |
+ void SetTilePriority(Tile* tile) const; |
+ |
// Given properties. |
float contents_scale_; |
gfx::Size layer_bounds_; |
@@ -295,18 +312,24 @@ class CC_EXPORT PictureLayerTiling { |
TileMap tiles_; // It is not legal to have a NULL tile in the tiles_ map. |
gfx::Rect live_tiles_rect_; |
+ base::hash_set<std::pair<int, int> > occlusion_set_; |
+ |
// State saved for computing velocities based upon finite differences. |
double last_impl_frame_time_in_seconds_; |
gfx::Rect last_visible_rect_in_content_space_; |
+ float content_to_screen_scale_; |
gfx::Rect current_visible_rect_in_content_space_; |
gfx::Rect current_skewport_; |
gfx::Rect current_eventually_rect_; |
gfx::Rect current_soon_border_rect_; |
+ bool current_visible_rect_has_tiles_; |
+ bool current_skewport_has_tiles_; |
+ bool current_eventually_rect_has_tiles_; |
+ bool current_soon_border_rect_has_tiles_; |
+ |
std::vector<Tile*> eviction_tiles_cache_; |
- bool eviction_tiles_cache_valid_; |
- TreePriority eviction_cache_tree_priority_; |
private: |
DISALLOW_ASSIGN(PictureLayerTiling); |