| Index: cc/layers/picture_layer_impl.cc
|
| diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
|
| index 7299bc09fc62f5601029dfcb572e380f0565282c..5452941793305803df01e77e42039b1e5272a1f4 100644
|
| --- a/cc/layers/picture_layer_impl.cc
|
| +++ b/cc/layers/picture_layer_impl.cc
|
| @@ -61,7 +61,7 @@ PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* tree_impl, int id)
|
| raster_contents_scale_(0.f),
|
| low_res_raster_contents_scale_(0.f),
|
| raster_source_scale_is_fixed_(false),
|
| - was_animating_transform_to_screen_(false),
|
| + was_screen_space_transform_animating_(false),
|
| needs_post_commit_initialization_(true),
|
| should_update_tile_priorities_(false) {
|
| layer_tree_impl()->RegisterPictureLayerImpl(this);
|
| @@ -387,8 +387,8 @@ void PictureLayerImpl::AppendQuads(QuadSink* quad_sink,
|
| CleanUpTilingsOnActiveLayer(seen_tilings);
|
| }
|
|
|
| -void PictureLayerImpl::UpdateTilePriorities() {
|
| - TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities");
|
| +void PictureLayerImpl::UpdateTiles() {
|
| + TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTiles");
|
|
|
| DoPostCommitInitializationIfNeeded();
|
|
|
| @@ -407,16 +407,36 @@ void PictureLayerImpl::UpdateTilePriorities() {
|
| return;
|
| }
|
|
|
| + UpdateIdealScales();
|
| +
|
| + DCHECK(tilings_->num_tilings() > 0 || raster_contents_scale_ == 0.f)
|
| + << "A layer with no tilings shouldn't have valid raster scales";
|
| + if (!raster_contents_scale_ || ShouldAdjustRasterScale()) {
|
| + RecalculateRasterScales();
|
| + AddTilingsForRasterScale();
|
| + }
|
| +
|
| + DCHECK(raster_page_scale_);
|
| + DCHECK(raster_device_scale_);
|
| + DCHECK(raster_source_scale_);
|
| + DCHECK(raster_contents_scale_);
|
| + DCHECK(low_res_raster_contents_scale_);
|
| +
|
| + was_screen_space_transform_animating_ =
|
| + draw_properties().screen_space_transform_is_animating;
|
| +
|
| // TODO(sohanjg): Avoid needlessly update priorities when syncing to a
|
| // non-updated tree which will then be updated immediately afterwards.
|
| should_update_tile_priorities_ = true;
|
|
|
| - UpdateIdealScales();
|
| - ManageTilings(draw_properties().screen_space_transform_is_animating,
|
| - draw_properties().maximum_animation_contents_scale);
|
| + UpdateTilePriorities();
|
|
|
| - if (!tilings_->num_tilings())
|
| - return;
|
| + if (layer_tree_impl()->IsPendingTree())
|
| + MarkVisibleResourcesAsRequired();
|
| +}
|
| +
|
| +void PictureLayerImpl::UpdateTilePriorities() {
|
| + TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities");
|
|
|
| double current_frame_time_in_seconds =
|
| (layer_tree_impl()->CurrentFrameTimeTicks() -
|
| @@ -451,15 +471,14 @@ void PictureLayerImpl::UpdateTilePriorities() {
|
| visible_rect_in_content_space, 1.f / contents_scale_x());
|
| WhichTree tree =
|
| layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE;
|
| - // TODO(sohanjg): Passing MaximumContentsScale as layer contents scale
|
| - // in UpdateTilePriorities is wrong and should be ideal contents scale.
|
| - tilings_->UpdateTilePriorities(tree,
|
| - visible_layer_rect,
|
| - MaximumTilingContentsScale(),
|
| - current_frame_time_in_seconds);
|
| -
|
| - if (layer_tree_impl()->IsPendingTree())
|
| - MarkVisibleResourcesAsRequired();
|
| + for (size_t i = 0; i < tilings_->num_tilings(); ++i) {
|
| + // TODO(sohanjg): Passing MaximumContentsScale as layer contents scale
|
| + // in UpdateTilePriorities is wrong and should be ideal contents scale.
|
| + tilings_->tiling_at(i)->UpdateTilePriorities(tree,
|
| + visible_layer_rect,
|
| + MaximumTilingContentsScale(),
|
| + current_frame_time_in_seconds);
|
| + }
|
|
|
| // Tile priorities were modified.
|
| layer_tree_impl()->DidModifyTilePriorities();
|
| @@ -726,7 +745,6 @@ ResourceProvider::ResourceId PictureLayerImpl::ContentsResourceId() const {
|
|
|
| void PictureLayerImpl::MarkVisibleResourcesAsRequired() const {
|
| DCHECK(layer_tree_impl()->IsPendingTree());
|
| - DCHECK(!layer_tree_impl()->needs_update_draw_properties());
|
| DCHECK(ideal_contents_scale_);
|
| DCHECK_GT(tilings_->num_tilings(), 0u);
|
|
|
| @@ -940,38 +958,7 @@ inline float PositiveRatio(float float1, float float2) {
|
|
|
| } // namespace
|
|
|
| -void PictureLayerImpl::ManageTilings(bool animating_transform_to_screen,
|
| - float maximum_animation_contents_scale) {
|
| - DCHECK(ideal_contents_scale_);
|
| - DCHECK(ideal_page_scale_);
|
| - DCHECK(ideal_device_scale_);
|
| - DCHECK(ideal_source_scale_);
|
| - DCHECK(CanHaveTilings());
|
| - DCHECK(!needs_post_commit_initialization_);
|
| -
|
| - bool change_target_tiling =
|
| - raster_page_scale_ == 0.f ||
|
| - raster_device_scale_ == 0.f ||
|
| - raster_source_scale_ == 0.f ||
|
| - raster_contents_scale_ == 0.f ||
|
| - low_res_raster_contents_scale_ == 0.f ||
|
| - ShouldAdjustRasterScale(animating_transform_to_screen);
|
| -
|
| - if (tilings_->num_tilings() == 0) {
|
| - DCHECK(change_target_tiling)
|
| - << "A layer with no tilings shouldn't have valid raster scales";
|
| - }
|
| -
|
| - if (change_target_tiling) {
|
| - RecalculateRasterScales(animating_transform_to_screen,
|
| - maximum_animation_contents_scale);
|
| - }
|
| -
|
| - was_animating_transform_to_screen_ = animating_transform_to_screen;
|
| -
|
| - if (!change_target_tiling)
|
| - return;
|
| -
|
| +void PictureLayerImpl::AddTilingsForRasterScale() {
|
| PictureLayerTiling* high_res = NULL;
|
| PictureLayerTiling* low_res = NULL;
|
|
|
| @@ -1000,7 +987,8 @@ void PictureLayerImpl::ManageTilings(bool animating_transform_to_screen,
|
| // tiling during a pinch or a CSS animation.
|
| bool is_pinching = layer_tree_impl()->PinchGestureActive();
|
| if (layer_tree_impl()->create_low_res_tiling() && !is_pinching &&
|
| - !animating_transform_to_screen && !low_res && low_res != high_res)
|
| + !draw_properties().screen_space_transform_is_animating && !low_res &&
|
| + low_res != high_res)
|
| low_res = AddTiling(low_res_raster_contents_scale_);
|
|
|
| // Set low-res if we have one.
|
| @@ -1015,9 +1003,9 @@ void PictureLayerImpl::ManageTilings(bool animating_transform_to_screen,
|
| SanityCheckTilingState();
|
| }
|
|
|
| -bool PictureLayerImpl::ShouldAdjustRasterScale(
|
| - bool animating_transform_to_screen) const {
|
| - if (was_animating_transform_to_screen_ != animating_transform_to_screen)
|
| +bool PictureLayerImpl::ShouldAdjustRasterScale() const {
|
| + if (was_screen_space_transform_animating_ !=
|
| + draw_properties().screen_space_transform_is_animating)
|
| return true;
|
|
|
| bool is_pinching = layer_tree_impl()->PinchGestureActive();
|
| @@ -1043,7 +1031,8 @@ bool PictureLayerImpl::ShouldAdjustRasterScale(
|
|
|
| // When the source scale changes we want to match it, but not when animating
|
| // or when we've fixed the scale in place.
|
| - if (!animating_transform_to_screen && !raster_source_scale_is_fixed_ &&
|
| + if (!draw_properties().screen_space_transform_is_animating &&
|
| + !raster_source_scale_is_fixed_ &&
|
| raster_source_scale_ != ideal_source_scale_)
|
| return true;
|
|
|
| @@ -1065,9 +1054,7 @@ float PictureLayerImpl::SnappedContentsScale(float scale) {
|
| return snapped_contents_scale;
|
| }
|
|
|
| -void PictureLayerImpl::RecalculateRasterScales(
|
| - bool animating_transform_to_screen,
|
| - float maximum_animation_contents_scale) {
|
| +void PictureLayerImpl::RecalculateRasterScales() {
|
| float old_raster_contents_scale = raster_contents_scale_;
|
| float old_raster_page_scale = raster_page_scale_;
|
| float old_raster_source_scale = raster_source_scale_;
|
| @@ -1080,8 +1067,9 @@ void PictureLayerImpl::RecalculateRasterScales(
|
| // If we're not animating, or leaving an animation, and the
|
| // ideal_source_scale_ changes, then things are unpredictable, and we fix
|
| // the raster_source_scale_ in place.
|
| - if (old_raster_source_scale && !animating_transform_to_screen &&
|
| - !was_animating_transform_to_screen_ &&
|
| + if (old_raster_source_scale &&
|
| + !draw_properties().screen_space_transform_is_animating &&
|
| + !was_screen_space_transform_animating_ &&
|
| old_raster_source_scale != ideal_source_scale_)
|
| raster_source_scale_is_fixed_ = true;
|
|
|
| @@ -1117,10 +1105,11 @@ 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.
|
| - if (animating_transform_to_screen) {
|
| - if (maximum_animation_contents_scale > 0.f) {
|
| + if (draw_properties().screen_space_transform_is_animating) {
|
| + if (draw_properties().maximum_animation_contents_scale > 0.f) {
|
| raster_contents_scale_ =
|
| - std::max(raster_contents_scale_, maximum_animation_contents_scale);
|
| + std::max(raster_contents_scale_,
|
| + draw_properties().maximum_animation_contents_scale);
|
| } else {
|
| raster_contents_scale_ =
|
| std::max(raster_contents_scale_,
|
|
|