| Index: cc/layers/picture_layer_impl.cc
|
| diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
|
| index 22a00baebdb250a7571df70cb8ae4e87bfb5d386..a60441b834a0416e5cdd9a0dcf0694791e96e706 100644
|
| --- a/cc/layers/picture_layer_impl.cc
|
| +++ b/cc/layers/picture_layer_impl.cc
|
| @@ -413,6 +413,7 @@ void PictureLayerImpl::CalculateContentsScale(
|
| float ideal_contents_scale,
|
| float device_scale_factor,
|
| float page_scale_factor,
|
| + float maximum_animation_scale_factor,
|
| bool animating_transform_to_screen,
|
| float* contents_scale_x,
|
| float* contents_scale_y,
|
| @@ -455,7 +456,7 @@ void PictureLayerImpl::CalculateContentsScale(
|
| ideal_device_scale_ = ideal_device_scale;
|
| ideal_source_scale_ = std::max(ideal_source_scale, min_source_scale);
|
|
|
| - ManageTilings(animating_transform_to_screen);
|
| + ManageTilings(animating_transform_to_screen, maximum_animation_scale_factor);
|
|
|
| // The content scale and bounds for a PictureLayerImpl is somewhat fictitious.
|
| // There are (usually) several tilings at different scales. However, the
|
| @@ -917,7 +918,8 @@ inline float PositiveRatio(float float1, float float2) {
|
|
|
| } // namespace
|
|
|
| -void PictureLayerImpl::ManageTilings(bool animating_transform_to_screen) {
|
| +void PictureLayerImpl::ManageTilings(bool animating_transform_to_screen,
|
| + float maximum_animation_scale_factor) {
|
| DCHECK(ideal_contents_scale_);
|
| DCHECK(ideal_page_scale_);
|
| DCHECK(ideal_device_scale_);
|
| @@ -947,7 +949,8 @@ void PictureLayerImpl::ManageTilings(bool animating_transform_to_screen) {
|
| if (!layer_tree_impl()->device_viewport_valid_for_tile_management())
|
| return;
|
|
|
| - RecalculateRasterScales(animating_transform_to_screen);
|
| + RecalculateRasterScales(animating_transform_to_screen,
|
| + maximum_animation_scale_factor);
|
|
|
| PictureLayerTiling* high_res = NULL;
|
| PictureLayerTiling* low_res = NULL;
|
| @@ -1000,7 +1003,7 @@ bool PictureLayerImpl::ShouldAdjustRasterScale(
|
| // tree. This will allow CSS scale changes to get re-rastered at an
|
| // appropriate rate.
|
|
|
| - if (raster_source_scale_was_animating_ && !animating_transform_to_screen)
|
| + if (raster_source_scale_was_animating_ != animating_transform_to_screen)
|
| return true;
|
|
|
| if (animating_transform_to_screen &&
|
| @@ -1048,7 +1051,8 @@ float PictureLayerImpl::SnappedContentsScale(float scale) {
|
| }
|
|
|
| void PictureLayerImpl::RecalculateRasterScales(
|
| - bool animating_transform_to_screen) {
|
| + bool animating_transform_to_screen,
|
| + float maximum_animation_scale_factor) {
|
| raster_device_scale_ = ideal_device_scale_;
|
| raster_source_scale_ = ideal_source_scale_;
|
|
|
| @@ -1072,11 +1076,19 @@ void PictureLayerImpl::RecalculateRasterScales(
|
| raster_contents_scale_ =
|
| std::max(raster_contents_scale_, MinimumContentsScale());
|
|
|
| - // Don't allow animating CSS scales to drop below 1 if we're not
|
| - // re-rasterizing during the animation.
|
| + // If we're not re-rasterizing during animation, rasterize at the maximum
|
| + // scale that will occur during the animation, if the maximum scale is
|
| + // known.
|
| if (animating_transform_to_screen && !ShouldUseGpuRasterization()) {
|
| - raster_contents_scale_ = std::max(
|
| - raster_contents_scale_, 1.f * ideal_page_scale_ * ideal_device_scale_);
|
| + if (maximum_animation_scale_factor > 0.f) {
|
| + raster_contents_scale_ =
|
| + std::max(raster_contents_scale_,
|
| + maximum_animation_scale_factor * ideal_contents_scale_);
|
| + } else {
|
| + raster_contents_scale_ =
|
| + std::max(raster_contents_scale_,
|
| + 1.f * ideal_page_scale_ * ideal_device_scale_);
|
| + }
|
| }
|
|
|
| // If this layer would only create one tile at this content scale,
|
|
|