| Index: cc/layers/picture_layer_impl.cc
|
| diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
|
| index e51821fbc92a7d2b8f13536998b41210f141003d..2e68be7319a2e6b555fd7b6ea6e9f6be2a6bfecb 100644
|
| --- a/cc/layers/picture_layer_impl.cc
|
| +++ b/cc/layers/picture_layer_impl.cc
|
| @@ -155,6 +155,11 @@ void PictureLayerImpl::AppendQuads(RenderPass* render_pass,
|
| const Occlusion& occlusion_in_content_space,
|
| AppendQuadsData* append_quads_data) {
|
| DCHECK(!needs_post_commit_initialization_);
|
| + // The bounds and the pile size may differ if the pile wasn't updated (ie.
|
| + // PictureLayer::Update didn't happen). But that should never be the case if
|
| + // the layer is part of the visible frame, which is why we're appending quads
|
| + // in the first place
|
| + DCHECK_EQ(bounds().ToString(), pile_->tiling_size().ToString());
|
|
|
| SharedQuadState* shared_quad_state =
|
| render_pass->CreateAndAppendSharedQuadState();
|
| @@ -163,7 +168,7 @@ void PictureLayerImpl::AppendQuads(RenderPass* render_pass,
|
| PopulateSharedQuadState(shared_quad_state);
|
|
|
| AppendDebugBorderQuad(
|
| - render_pass, content_bounds(), shared_quad_state, append_quads_data);
|
| + render_pass, bounds(), shared_quad_state, append_quads_data);
|
|
|
| SolidColorLayerImpl::AppendSolidQuads(render_pass,
|
| occlusion_in_content_space,
|
| @@ -179,7 +184,7 @@ void PictureLayerImpl::AppendQuads(RenderPass* render_pass,
|
| scaled_draw_transform.Scale(SK_MScalar1 / max_contents_scale,
|
| SK_MScalar1 / max_contents_scale);
|
| gfx::Size scaled_content_bounds =
|
| - gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), max_contents_scale));
|
| + gfx::ToCeiledSize(gfx::ScaleSize(bounds(), max_contents_scale));
|
| gfx::Rect scaled_visible_content_rect =
|
| gfx::ScaleToEnclosingRect(visible_content_rect(), max_contents_scale);
|
| scaled_visible_content_rect.Intersect(gfx::Rect(scaled_content_bounds));
|
| @@ -770,8 +775,10 @@ void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) {
|
|
|
| bool synced_high_res_tiling = false;
|
| if (CanHaveTilings()) {
|
| - synced_high_res_tiling = tilings_->SyncTilings(
|
| - *other->tilings_, bounds(), invalidation_, MinimumContentsScale());
|
| + synced_high_res_tiling = tilings_->SyncTilings(*other->tilings_,
|
| + pile_->tiling_size(),
|
| + invalidation_,
|
| + MinimumContentsScale());
|
| } else {
|
| RemoveAllTilings();
|
| }
|
| @@ -793,7 +800,7 @@ void PictureLayerImpl::SyncTiling(
|
| const PictureLayerTiling* tiling) {
|
| if (!CanHaveTilingWithScale(tiling->contents_scale()))
|
| return;
|
| - tilings_->AddTiling(tiling->contents_scale(), bounds());
|
| + tilings_->AddTiling(tiling->contents_scale(), pile_->tiling_size());
|
|
|
| // If this tree needs update draw properties, then the tiling will
|
| // get updated prior to drawing or activation. If this tree does not
|
| @@ -812,6 +819,7 @@ void PictureLayerImpl::SyncTiling(
|
| void PictureLayerImpl::GetContentsResourceId(
|
| ResourceProvider::ResourceId* resource_id,
|
| gfx::Size* resource_size) const {
|
| + DCHECK_EQ(bounds().ToString(), pile_->tiling_size().ToString());
|
| gfx::Rect content_rect(bounds());
|
| PictureLayerTilingSet::CoverageIterator iter(
|
| tilings_.get(), 1.f, content_rect, ideal_contents_scale_);
|
| @@ -864,7 +872,8 @@ PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) {
|
| DCHECK(CanHaveTilingWithScale(contents_scale)) <<
|
| "contents_scale: " << contents_scale;
|
|
|
| - PictureLayerTiling* tiling = tilings_->AddTiling(contents_scale, bounds());
|
| + PictureLayerTiling* tiling =
|
| + tilings_->AddTiling(contents_scale, pile_->tiling_size());
|
|
|
| DCHECK(pile_->HasRecordings());
|
|
|
| @@ -1067,8 +1076,8 @@ void PictureLayerImpl::RecalculateRasterScales() {
|
| // See crbug.com/422341.
|
| float maximum_scale = draw_properties().maximum_animation_contents_scale;
|
| if (maximum_scale) {
|
| - gfx::Size bounds_at_maximum_scale =
|
| - gfx::ToCeiledSize(gfx::ScaleSize(bounds(), maximum_scale));
|
| + gfx::Size bounds_at_maximum_scale = gfx::ToCeiledSize(
|
| + gfx::ScaleSize(pile_->tiling_size(), maximum_scale));
|
| if (bounds_at_maximum_scale.GetArea() <=
|
| layer_tree_impl()->device_viewport_size().GetArea())
|
| can_raster_at_maximum_scale = true;
|
| @@ -1084,11 +1093,11 @@ void PictureLayerImpl::RecalculateRasterScales() {
|
|
|
| // If this layer would create zero or one tiles at this content scale,
|
| // don't create a low res tiling.
|
| - gfx::Size content_bounds =
|
| - gfx::ToCeiledSize(gfx::ScaleSize(bounds(), raster_contents_scale_));
|
| - gfx::Size tile_size = CalculateTileSize(content_bounds);
|
| - bool tile_covers_bounds = tile_size.width() >= content_bounds.width() &&
|
| - tile_size.height() >= content_bounds.height();
|
| + gfx::Size raster_bounds = gfx::ToCeiledSize(
|
| + gfx::ScaleSize(pile_->tiling_size(), raster_contents_scale_));
|
| + gfx::Size tile_size = CalculateTileSize(raster_bounds);
|
| + bool tile_covers_bounds = tile_size.width() >= raster_bounds.width() &&
|
| + tile_size.height() >= raster_bounds.height();
|
| if (tile_size.IsEmpty() || tile_covers_bounds) {
|
| low_res_raster_contents_scale_ = raster_contents_scale_;
|
| return;
|
| @@ -1185,7 +1194,8 @@ float PictureLayerImpl::MinimumContentsScale() const {
|
| // then it will end up having less than one pixel of content in that
|
| // dimension. Bump the minimum contents scale up in this case to prevent
|
| // this from happening.
|
| - int min_dimension = std::min(bounds().width(), bounds().height());
|
| + int min_dimension =
|
| + std::min(pile_->tiling_size().width(), pile_->tiling_size().height());
|
| if (!min_dimension)
|
| return setting_min;
|
|
|
| @@ -1318,10 +1328,11 @@ void PictureLayerImpl::AsValueInto(base::debug::TracedValue* state) const {
|
| state->EndArray();
|
|
|
| state->BeginArray("coverage_tiles");
|
| - for (PictureLayerTilingSet::CoverageIterator iter(tilings_.get(),
|
| - 1.f,
|
| - gfx::Rect(content_bounds()),
|
| - ideal_contents_scale_);
|
| + for (PictureLayerTilingSet::CoverageIterator iter(
|
| + tilings_.get(),
|
| + 1.f,
|
| + gfx::Rect(pile_->tiling_size()),
|
| + ideal_contents_scale_);
|
| iter;
|
| ++iter) {
|
| state->BeginDictionary();
|
|
|