| Index: cc/picture_layer_impl.cc
|
| diff --git a/cc/picture_layer_impl.cc b/cc/picture_layer_impl.cc
|
| index 523c5f1517315b7c5060be3fe284e3b2011517e8..e8e9631a5b747dba40ef830a073e278ab8fec0d0 100644
|
| --- a/cc/picture_layer_impl.cc
|
| +++ b/cc/picture_layer_impl.cc
|
| @@ -129,13 +129,15 @@ void PictureLayerImpl::dumpLayerProperties(std::string*, int indent) const {
|
|
|
| void PictureLayerImpl::didUpdateTransforms() {
|
| if (drawsContent()) {
|
| - // TODO(enne): Add more tilings during pinch zoom.
|
| + // TODO(enne): Add tilings during pinch zoom
|
| + // TODO(enne): Consider culling old tilings after pinch finishes.
|
| if (!tilings_.num_tilings()) {
|
| gfx::Size tile_size = layerTreeImpl()->settings().defaultTileSize;
|
| - tilings_.AddTiling(contentsScaleX(), tile_size);
|
| - // TODO(enne): handle invalidations, create new tiles
|
| + AddTiling(contentsScaleX(), tile_size);
|
| + // TODO(enne): Add a low-res tiling as well.
|
| }
|
| } else {
|
| + // TODO(enne): This should be unnecessary once there are two trees.
|
| tilings_.Reset();
|
| }
|
|
|
| @@ -182,7 +184,30 @@ scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling,
|
| }
|
|
|
| void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) {
|
| - tilings_.CloneFrom(other->tilings_);
|
| + tilings_.CloneAll(other->tilings_, invalidation_);
|
| +}
|
| +
|
| +void PictureLayerImpl::SyncTilingFromActiveLayer(
|
| + const PictureLayerTiling* tiling) {
|
| + tilings_.Clone(tiling, invalidation_);
|
| +}
|
| +
|
| +void PictureLayerImpl::AddTiling(float contents_scale, gfx::Size tile_size) {
|
| + const PictureLayerTiling* tiling = tilings_.AddTiling(
|
| + contents_scale,
|
| + tile_size);
|
| +
|
| + // If a new tiling is created on the active tree, sync it to the pending tree
|
| + // so that it can share the same tiles.
|
| + if (layerTreeImpl()->IsActiveTree())
|
| + return;
|
| +
|
| + PictureLayerImpl* pending_twin = static_cast<PictureLayerImpl*>(
|
| + layerTreeImpl()->PendingTreeLayerById(id()));
|
| + if (!pending_twin)
|
| + return;
|
| + DCHECK_EQ(id(), pending_twin->id());
|
| + pending_twin->SyncTilingFromActiveLayer(tiling);
|
| }
|
|
|
| } // namespace cc
|
|
|