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

Unified Diff: cc/resources/picture_layer_tiling.cc

Issue 13895005: cc: Find a better prioritized rect when the viewport rect is huge. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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/picture_layer_tiling_set.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 3035033bdc20e85fecf2b77ccfb4fbcdb1202447..b83cc4eb99497f6c979aaed314df0f7893cabf38 100644
--- a/cc/resources/picture_layer_tiling.cc
+++ b/cc/resources/picture_layer_tiling.cc
@@ -342,6 +342,7 @@ void PictureLayerTiling::UpdateTilePriorities(
WhichTree tree,
gfx::Size device_viewport,
const gfx::RectF& viewport_in_layer_space,
+ const gfx::RectF& visible_layer_rect,
gfx::Size last_layer_bounds,
gfx::Size current_layer_bounds,
float last_layer_contents_scale,
@@ -378,14 +379,20 @@ void PictureLayerTiling::UpdateTilePriorities(
gfx::Rect viewport_in_content_space =
gfx::ToEnclosingRect(gfx::ScaleRect(viewport_in_layer_space,
contents_scale_));
+ gfx::Rect visible_content_rect =
+ gfx::ToEnclosingRect(gfx::ScaleRect(visible_layer_rect,
+ contents_scale_));
gfx::Size tile_size = tiling_data_.max_texture_size();
int64 prioritized_rect_area =
max_tiles_for_interest_area *
tile_size.width() * tile_size.height();
+ gfx::Rect starting_rect = visible_content_rect.IsEmpty()
+ ? viewport_in_content_space
+ : visible_content_rect;
gfx::Rect prioritized_rect = ExpandRectEquallyToAreaBoundedBy(
- viewport_in_content_space,
+ starting_rect,
prioritized_rect_area,
ContentRect());
DCHECK(ContentRect().Contains(prioritized_rect));
@@ -565,21 +572,18 @@ gfx::Rect PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
DCHECK(!bounding_rect.IsEmpty());
DCHECK_GT(target_area, 0);
- // Expand the starting rect to cover target_area.
+ // Expand the starting rect to cover target_area, if it is smaller than it.
int delta = ComputeExpansionDelta(
2, 2, starting_rect.width(), starting_rect.height(), target_area);
gfx::Rect expanded_starting_rect = starting_rect;
- expanded_starting_rect.Inset(-delta, -delta);
+ if (delta > 0)
+ expanded_starting_rect.Inset(-delta, -delta);
gfx::Rect rect = IntersectRects(expanded_starting_rect, bounding_rect);
if (rect.IsEmpty()) {
// The starting_rect and bounding_rect are far away.
return rect;
}
- if (rect == expanded_starting_rect) {
- // The expanded starting rect already covers target_area on bounding_rect.
- return rect;
- }
Xianzhu 2013/04/16 22:42:52 I think we can still keep this shortcut by adding
danakj 2013/04/17 01:13:34 PictureLayerTilingIteratorTest.TilesExistLargeView
// Continue to expand rect to let it cover target_area.
« no previous file with comments | « cc/resources/picture_layer_tiling.h ('k') | cc/resources/picture_layer_tiling_set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698