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

Unified Diff: cc/resources/picture_layer_tiling.cc

Issue 13582006: Prioritize tiles near the viewport in out-of-viewport layers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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_unittest.cc » ('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 c3a2ffe17d6a604b94cab4b2f09199202b9115cd..01f933ec0c48f1bf5316e6543adad05c0cd316be 100644
--- a/cc/resources/picture_layer_tiling.cc
+++ b/cc/resources/picture_layer_tiling.cc
@@ -375,6 +375,17 @@ void PictureLayerTiling::UpdateTilePriorities(
viewport_in_content_space,
prioritized_rect_area,
ContentRect());
+
+ if (prioritized_rect.IsEmpty()) {
+ // For a layer out of the viewport, prioritize its tiles near to the
+ // viewport border so that they could be available when scrolled in.
+ prioritized_rect = ExpandRectBySizeBoundedBy(
danakj 2013/04/03 23:08:34 NAK: Using the viewport rect (or something at most
+ viewport_in_content_space,
+ tile_size.width() * 2,
+ tile_size.height() * 2,
+ ContentRect());
+ }
+
DCHECK(ContentRect().Contains(prioritized_rect));
// Iterate through all of the tiles that were live last frame but will
@@ -531,6 +542,7 @@ gfx::Rect PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
DCHECK_GT(target_area, 0);
gfx::Rect rect = IntersectRects(starting_rect, bounding_rect);
+
if (rect.IsEmpty())
enne (OOO) 2013/04/03 23:41:49 I think this patch should really just remove this
return rect;
@@ -614,4 +626,13 @@ gfx::Rect PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
return gfx::Rect(origin_x, origin_y, width, height);
}
+gfx::Rect PictureLayerTiling::ExpandRectBySizeBoundedBy(
+ gfx::Rect starting_rect,
+ int horizontal_expansion,
+ int vertical_expansion,
+ gfx::Rect bounding_rect) {
+ starting_rect.Inset(-horizontal_expansion, -vertical_expansion);
+ return IntersectRects(starting_rect, bounding_rect);
+}
+
} // namespace cc
« no previous file with comments | « cc/resources/picture_layer_tiling.h ('k') | cc/resources/picture_layer_tiling_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698