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

Unified Diff: cc/layers/picture_layer_impl.cc

Issue 420523002: cc: Don't rasterize large layers at maximum scale before scale animations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/picture_layer_impl.cc
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index 4a7e0c0b0b66ae5bdf20743b65c0f51c69824c0d..4b676fe279d6ef17bec367c6db04f8e599203791 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -1111,9 +1111,18 @@ void PictureLayerImpl::RecalculateRasterScales() {
// Since we're not re-rasterizing during animation, rasterize at the maximum
// scale that will occur during the animation, if the maximum scale is
- // known.
+ // known. However, to avoid excessive memory use, don't rasterize at a scale
+ // at which this layer would become larger than the viewport.
if (draw_properties().screen_space_transform_is_animating) {
+ bool can_raster_at_maximum_scale = false;
if (draw_properties().maximum_animation_contents_scale > 0.f) {
+ gfx::Size bounds_at_maximum_scale = gfx::ToCeiledSize(gfx::ScaleSize(
+ bounds(), draw_properties().maximum_animation_contents_scale));
+ if (bounds_at_maximum_scale.GetArea() <=
+ layer_tree_impl()->device_viewport_size().GetArea())
+ can_raster_at_maximum_scale = true;
+ }
+ if (can_raster_at_maximum_scale) {
raster_contents_scale_ =
std::max(raster_contents_scale_,
draw_properties().maximum_animation_contents_scale);
« no previous file with comments | « no previous file | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698