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

Unified Diff: cc/picture_layer_impl.cc

Issue 11574026: cc: Add some more infrastructure for two trees (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/picture_layer_impl.h ('k') | cc/picture_layer_tiling_set.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/picture_layer_impl.cc
diff --git a/cc/picture_layer_impl.cc b/cc/picture_layer_impl.cc
index 523c5f1517315b7c5060be3fe284e3b2011517e8..e844f67d89648693266584923566da41b218beef 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();
}
@@ -181,8 +183,46 @@ scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling,
tiling->contents_scale()));
}
+void PictureLayerImpl::SyncFromActiveLayer() {
+ DCHECK(layerTreeImpl()->IsPendingTree());
+ if (!drawsContent())
+ return;
+
+ // If there is an active tree version of this layer, get a copy of its
+ // tiles. This needs to be done last, after setting invalidation and the
+ // pile.
+ PictureLayerImpl* active_twin = static_cast<PictureLayerImpl*>(
+ layerTreeImpl()->FindActiveTreeLayerById(id()));
+ if (!active_twin)
+ return;
+ SyncFromActiveLayer(active_twin);
+}
+
void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) {
- tilings_.CloneFrom(other->tilings_);
+ tilings_.CloneAll(other->tilings_, invalidation_);
+}
+
+void PictureLayerImpl::SyncTiling(
+ 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()->FindPendingTreeLayerById(id()));
+ if (!pending_twin)
+ return;
+ DCHECK_EQ(id(), pending_twin->id());
+ pending_twin->SyncTiling(tiling);
}
} // namespace cc
« no previous file with comments | « cc/picture_layer_impl.h ('k') | cc/picture_layer_tiling_set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698