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

Unified Diff: cc/resources/picture_layer_tiling.cc

Issue 1126813002: cc: Pass priority rect information from iterators to tilings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase fix Created 5 years, 7 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/resources/picture_layer_tiling.h ('k') | cc/resources/tiling_set_eviction_queue.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/picture_layer_tiling.cc
diff --git a/cc/resources/picture_layer_tiling.cc b/cc/resources/picture_layer_tiling.cc
index e21a3aa0076ab09086fe23f53950e7656ee4c387..30f5d79d1920c7016d18fff2377d33fcc89cf843 100644
--- a/cc/resources/picture_layer_tiling.cc
+++ b/cc/resources/picture_layer_tiling.cc
@@ -805,7 +805,9 @@ void PictureLayerTiling::UpdateRequiredStatesOnTile(Tile* tile) const {
tile->set_required_for_draw(IsTileRequiredForDraw(tile));
}
-PrioritizedTile PictureLayerTiling::MakePrioritizedTile(Tile* tile) const {
+PrioritizedTile PictureLayerTiling::MakePrioritizedTile(
+ Tile* tile,
+ PriorityRectType priority_rect_type) const {
DCHECK(tile);
DCHECK(
raster_source()->CoversRect(tile->content_rect(), tile->contents_scale()))
@@ -813,7 +815,8 @@ PrioritizedTile PictureLayerTiling::MakePrioritizedTile(Tile* tile) const {
<< gfx::ScaleToEnclosingRect(tile->content_rect(),
1.f / tile->contents_scale()).ToString();
- return PrioritizedTile(tile, raster_source(), ComputePriorityForTile(tile),
+ return PrioritizedTile(tile, raster_source(),
+ ComputePriorityForTile(tile, priority_rect_type),
IsTileOccluded(tile));
}
@@ -821,53 +824,83 @@ std::map<const Tile*, PrioritizedTile>
PictureLayerTiling::UpdateAndGetAllPrioritizedTilesForTesting() const {
std::map<const Tile*, PrioritizedTile> result;
for (const auto& key_tile_pair : tiles_) {
- UpdateRequiredStatesOnTile(key_tile_pair.second);
+ Tile* tile = key_tile_pair.second;
+ UpdateRequiredStatesOnTile(tile);
PrioritizedTile prioritized_tile =
- MakePrioritizedTile(key_tile_pair.second);
+ MakePrioritizedTile(tile, ComputePriorityRectTypeForTile(tile));
result.insert(std::make_pair(prioritized_tile.tile(), prioritized_tile));
}
return result;
}
TilePriority PictureLayerTiling::ComputePriorityForTile(
- const Tile* tile) const {
+ const Tile* tile,
+ PriorityRectType priority_rect_type) const {
// TODO(vmpstr): See if this can be moved to iterators.
TilePriority::PriorityBin max_tile_priority_bin =
client_->GetMaxTilePriorityBin();
+ DCHECK_EQ(ComputePriorityRectTypeForTile(tile), priority_rect_type);
DCHECK_EQ(TileAt(tile->tiling_i_index(), tile->tiling_j_index()), tile);
- gfx::Rect tile_bounds =
- tiling_data_.TileBounds(tile->tiling_i_index(), tile->tiling_j_index());
- if (max_tile_priority_bin <= TilePriority::NOW &&
- current_visible_rect_.Intersects(tile_bounds)) {
- return TilePriority(resolution_, TilePriority::NOW, 0);
- }
+ TilePriority::PriorityBin priority_bin = max_tile_priority_bin;
- if (max_tile_priority_bin <= TilePriority::SOON &&
- pending_visible_rect().Intersects(tile_bounds)) {
- return TilePriority(resolution_, TilePriority::SOON, 0);
+ switch (priority_rect_type) {
+ case VISIBLE_RECT:
+ return TilePriority(resolution_, priority_bin, 0);
+ case PENDING_VISIBLE_RECT:
+ if (max_tile_priority_bin <= TilePriority::SOON)
+ return TilePriority(resolution_, TilePriority::SOON, 0);
+ priority_bin = TilePriority::EVENTUALLY;
+ break;
+ case SKEWPORT_RECT:
+ case SOON_BORDER_RECT:
+ if (max_tile_priority_bin <= TilePriority::SOON)
+ priority_bin = TilePriority::SOON;
+ break;
+ case EVENTUALLY_RECT:
+ priority_bin = TilePriority::EVENTUALLY;
+ break;
}
+ gfx::Rect tile_bounds =
+ tiling_data_.TileBounds(tile->tiling_i_index(), tile->tiling_j_index());
DCHECK_GT(current_content_to_screen_scale_, 0.f);
float distance_to_visible =
current_visible_rect_.ManhattanInternalDistance(tile_bounds) *
current_content_to_screen_scale_;
- if (max_tile_priority_bin <= TilePriority::SOON &&
- (current_soon_border_rect_.Intersects(tile_bounds) ||
- current_skewport_rect_.Intersects(tile_bounds))) {
- return TilePriority(resolution_, TilePriority::SOON, distance_to_visible);
- }
+ return TilePriority(resolution_, priority_bin, distance_to_visible);
+}
+
+PictureLayerTiling::PriorityRectType
+PictureLayerTiling::ComputePriorityRectTypeForTile(const Tile* tile) const {
+ DCHECK_EQ(TileAt(tile->tiling_i_index(), tile->tiling_j_index()), tile);
+ gfx::Rect tile_bounds =
+ tiling_data_.TileBounds(tile->tiling_i_index(), tile->tiling_j_index());
+
+ if (current_visible_rect_.Intersects(tile_bounds))
+ return VISIBLE_RECT;
+
+ if (pending_visible_rect().Intersects(tile_bounds))
+ return PENDING_VISIBLE_RECT;
+
+ if (current_skewport_rect_.Intersects(tile_bounds))
+ return SKEWPORT_RECT;
+
+ if (current_soon_border_rect_.Intersects(tile_bounds))
+ return SOON_BORDER_RECT;
- return TilePriority(resolution_, TilePriority::EVENTUALLY,
- distance_to_visible);
+ DCHECK(current_eventually_rect_.Intersects(tile_bounds));
+ return EVENTUALLY_RECT;
}
void PictureLayerTiling::GetAllPrioritizedTilesForTracing(
std::vector<PrioritizedTile>* prioritized_tiles) const {
for (const auto& tile_pair : tiles_) {
- prioritized_tiles->push_back(MakePrioritizedTile(tile_pair.second));
+ Tile* tile = tile_pair.second;
+ prioritized_tiles->push_back(
+ MakePrioritizedTile(tile, ComputePriorityRectTypeForTile(tile)));
}
}
« no previous file with comments | « cc/resources/picture_layer_tiling.h ('k') | cc/resources/tiling_set_eviction_queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698