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

Unified Diff: cc/picture_layer_tiling.cc

Issue 12084031: A host of micro-optimizations and a refactor of TimeForBoundsToIntersect (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | « no previous file | cc/tile.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/picture_layer_tiling.cc
diff --git a/cc/picture_layer_tiling.cc b/cc/picture_layer_tiling.cc
index a352bc6ecbf598c25a9e8aeab1fa5473e22f0f9e..758272d10ef20d2a5a0034c3917b01caec6186a1 100644
--- a/cc/picture_layer_tiling.cc
+++ b/cc/picture_layer_tiling.cc
@@ -281,42 +281,74 @@ void PictureLayerTiling::UpdateTilePriorities(
return;
gfx::Rect view_rect(gfx::Point(), device_viewport);
- int right = tiling_data_.TileXIndexFromSrcCoord(content_rect.width() - 1);
- int bottom = tiling_data_.TileYIndexFromSrcCoord(content_rect.height() - 1);
+ float current_scale = current_layer_contents_scale / contents_scale_;
+ float last_scale = last_layer_contents_scale / contents_scale_;
+
+ if (last_screen_transform.IsIdentityOrTranslation() &&
+ current_screen_transform.IsIdentityOrTranslation())
+ {
+ gfx::Vector2dF current_offset(
+ current_screen_transform.matrix().get(0, 3),
+ current_screen_transform.matrix().get(1, 3));
+ gfx::Vector2dF last_offset(
+ last_screen_transform.matrix().get(0, 3),
+ last_screen_transform.matrix().get(1, 3));
+
+ for (TileMap::const_iterator it = tiles_.begin();
enne (OOO) 2013/01/28 22:55:10 This was already applied in your last UpdateTilePr
+ it != tiles_.end(); ++it) {
+ TileMapKey key = it->first;
+ TilePriority priority;
+ priority.resolution = resolution_;
+
+ gfx::Rect tile_bound = tiling_data_.TileBounds(key.first, key.second);
+ gfx::RectF current_screen_rect = gfx::ScaleRect(
+ tile_bound,
+ current_scale,
+ current_scale) + current_offset;
+ gfx::RectF last_screen_rect = gfx::ScaleRect(
+ tile_bound,
+ last_scale,
+ last_scale) + last_offset;
+
+ priority.distance_to_visible_in_pixels =
+ TilePriority::manhattanDistance(current_screen_rect, view_rect);
- for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) {
- TileMapKey key = it->first;
- TilePriority priority;
- priority.resolution = resolution_;
- if (key.first > right || key.second > bottom) {
- priority.distance_to_visible_in_pixels = std::numeric_limits<int>::max();
priority.time_to_visible_in_seconds =
- TilePriority::kMaxTimeToVisibleInSeconds;
+ TilePriority::TimeForBoundsToIntersect(
+ last_screen_rect, current_screen_rect, time_delta, view_rect);
it->second->set_priority(tree, priority);
- continue;
}
+ }
+ else
+ {
+ for (TileMap::const_iterator it = tiles_.begin();
+ it != tiles_.end(); ++it) {
+ TileMapKey key = it->first;
+ TilePriority priority;
+ priority.resolution = resolution_;
+
+ gfx::Rect tile_bound = tiling_data_.TileBounds(key.first, key.second);
+ gfx::RectF current_layer_content_rect = gfx::ScaleRect(
+ tile_bound,
+ current_scale,
+ current_scale);
+ gfx::RectF current_screen_rect = MathUtil::mapClippedRect(
+ current_screen_transform, current_layer_content_rect);
+ gfx::RectF last_layer_content_rect = gfx::ScaleRect(
+ tile_bound,
+ last_scale,
+ last_scale);
+ gfx::RectF last_screen_rect = MathUtil::mapClippedRect(
+ last_screen_transform, last_layer_content_rect);
+
+ priority.time_to_visible_in_seconds =
+ TilePriority::TimeForBoundsToIntersect(
+ last_screen_rect, current_screen_rect, time_delta, view_rect);
- gfx::Rect tile_bound = tiling_data_.TileBounds(key.first, key.second);
- gfx::RectF current_layer_content_rect = gfx::ScaleRect(
- tile_bound,
- current_layer_contents_scale / contents_scale_,
- current_layer_contents_scale / contents_scale_);
- gfx::RectF current_screen_rect = MathUtil::mapClippedRect(
- current_screen_transform, current_layer_content_rect);
- gfx::RectF last_layer_content_rect = gfx::ScaleRect(
- tile_bound,
- last_layer_contents_scale / contents_scale_,
- last_layer_contents_scale / contents_scale_);
- gfx::RectF last_screen_rect = MathUtil::mapClippedRect(
- last_screen_transform, last_layer_content_rect);
-
- priority.time_to_visible_in_seconds =
- TilePriority::TimeForBoundsToIntersect(
- last_screen_rect, current_screen_rect, time_delta, view_rect);
-
- priority.distance_to_visible_in_pixels =
- TilePriority::manhattanDistance(current_screen_rect, view_rect);
- it->second->set_priority(tree, priority);
+ priority.distance_to_visible_in_pixels =
+ TilePriority::manhattanDistance(current_screen_rect, view_rect);
+ it->second->set_priority(tree, priority);
+ }
}
}
« no previous file with comments | « no previous file | cc/tile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698