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

Side by Side Diff: cc/layers/picture_layer_impl.cc

Issue 642983003: cc: Make PictureLayerImpl use a better choice for animated raster scale. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: animationscale: onemorerename Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « cc/animation/transform_operations_unittest.cc ('k') | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 10
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 raster_contents_scale_ = 1163 raster_contents_scale_ =
1164 std::max(raster_contents_scale_, MinimumContentsScale()); 1164 std::max(raster_contents_scale_, MinimumContentsScale());
1165 1165
1166 // If we're not re-rasterizing during animation, rasterize at the maximum 1166 // If we're not re-rasterizing during animation, rasterize at the maximum
1167 // scale that will occur during the animation, if the maximum scale is 1167 // scale that will occur during the animation, if the maximum scale is
1168 // known. However, to avoid excessive memory use, don't rasterize at a scale 1168 // known. However, to avoid excessive memory use, don't rasterize at a scale
1169 // at which this layer would become larger than the viewport. 1169 // at which this layer would become larger than the viewport.
1170 if (draw_properties().screen_space_transform_is_animating && 1170 if (draw_properties().screen_space_transform_is_animating &&
1171 !ShouldAdjustRasterScaleDuringScaleAnimations()) { 1171 !ShouldAdjustRasterScaleDuringScaleAnimations()) {
1172 bool can_raster_at_maximum_scale = false; 1172 bool can_raster_at_maximum_scale = false;
1173 if (draw_properties().maximum_animation_contents_scale > 0.f) { 1173 float maximum_scale = draw_properties().maximum_animation_contents_scale;
1174 gfx::Size bounds_at_maximum_scale = gfx::ToCeiledSize(gfx::ScaleSize( 1174 if (maximum_scale) {
1175 bounds(), draw_properties().maximum_animation_contents_scale)); 1175 if (maximum_scale < raster_contents_scale_) {
1176 if (bounds_at_maximum_scale.GetArea() <=
1177 layer_tree_impl()->device_viewport_size().GetArea())
1178 can_raster_at_maximum_scale = true; 1176 can_raster_at_maximum_scale = true;
1177 } else {
1178 gfx::Size bounds_at_maximum_scale =
1179 gfx::ToCeiledSize(gfx::ScaleSize(bounds(), maximum_scale));
1180 if (bounds_at_maximum_scale.GetArea() <=
1181 layer_tree_impl()->device_viewport_size().GetArea())
1182 can_raster_at_maximum_scale = true;
1183 }
1179 } 1184 }
1180 if (can_raster_at_maximum_scale) { 1185 // Use the computed scales for the raster scale directly, do not try to use
1181 raster_contents_scale_ = 1186 // the ideal scale here. The current ideal scale may be way too large in the
1182 std::max(raster_contents_scale_, 1187 // case of an animation with scale, and will be constantly changing.
1183 draw_properties().maximum_animation_contents_scale); 1188 if (can_raster_at_maximum_scale)
1184 } else { 1189 raster_contents_scale_ = maximum_scale;
vmpstr 2014/10/10 00:50:49 If I understand this correctly, maximum_scale is a
danakj 2014/10/10 01:00:19 We'd raster new content at the very small scale ye
1185 raster_contents_scale_ = 1190 else
1186 std::max(raster_contents_scale_, 1191 raster_contents_scale_ = 1.f * ideal_page_scale_ * ideal_device_scale_;
1187 1.f * ideal_page_scale_ * ideal_device_scale_);
1188 }
1189 } 1192 }
1190 1193
1191 // If this layer would create zero or one tiles at this content scale, 1194 // If this layer would create zero or one tiles at this content scale,
1192 // don't create a low res tiling. 1195 // don't create a low res tiling.
1193 gfx::Size content_bounds = 1196 gfx::Size content_bounds =
1194 gfx::ToCeiledSize(gfx::ScaleSize(bounds(), raster_contents_scale_)); 1197 gfx::ToCeiledSize(gfx::ScaleSize(bounds(), raster_contents_scale_));
1195 gfx::Size tile_size = CalculateTileSize(content_bounds); 1198 gfx::Size tile_size = CalculateTileSize(content_bounds);
1196 bool tile_covers_bounds = tile_size.width() >= content_bounds.width() && 1199 bool tile_covers_bounds = tile_size.width() >= content_bounds.width() &&
1197 tile_size.height() >= content_bounds.height(); 1200 tile_size.height() >= content_bounds.height();
1198 if (tile_size.IsEmpty() || tile_covers_bounds) { 1201 if (tile_size.IsEmpty() || tile_covers_bounds) {
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
1783 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); 1786 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange();
1784 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; 1787 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start;
1785 return tiling_range.end - 1 - current_tiling_range_offset; 1788 return tiling_range.end - 1 - current_tiling_range_offset;
1786 } 1789 }
1787 } 1790 }
1788 NOTREACHED(); 1791 NOTREACHED();
1789 return 0; 1792 return 0;
1790 } 1793 }
1791 1794
1792 } // namespace cc 1795 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/transform_operations_unittest.cc ('k') | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698