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

Unified Diff: cc/picture_layer_impl.cc

Issue 11414238: implement the logic to set tile priorities based on current matrix (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressing comments 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
Index: cc/picture_layer_impl.cc
diff --git a/cc/picture_layer_impl.cc b/cc/picture_layer_impl.cc
index 18095964f70095b5ee16343138d2fc01f5003e4e..325d293c0e35c088a178185a13222cef83b4f6fb 100644
--- a/cc/picture_layer_impl.cc
+++ b/cc/picture_layer_impl.cc
@@ -4,6 +4,7 @@
#include "cc/picture_layer_impl.h"
+#include "base/time.h"
#include "cc/layer_tree_host_impl.h"
#include "cc/math_util.h"
#include "cc/quad_sink.h"
@@ -13,7 +14,8 @@ namespace cc {
PictureLayerImpl::PictureLayerImpl(int id) :
LayerImpl(id),
- tilings_(this) {
+ tilings_(this),
+ last_update_time_(0) {
}
PictureLayerImpl::~PictureLayerImpl() {
@@ -88,6 +90,21 @@ void PictureLayerImpl::didUpdateTransforms() {
tilings_.AddTiling(contentsScaleX(), tile_size);
// TODO(enne): handle invalidations, create new tiles
}
+
+ gfx::Transform current_screen_space_transform = screenSpaceTransform();
+ double current_time =
+ (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF();
+ double time_delta =
+ (last_update_time_ == 0 ? 0 : current_time - last_update_time_);
+ tilings_.UpdateTilePriorities(layerTreeHostImpl()->deviceViewportSize(),
+ contentsScaleX(),
+ contentsScaleY(),
+ last_screen_space_transform_,
+ current_screen_space_transform,
+ time_delta);
+
+ last_screen_space_transform_ = current_screen_space_transform;
+ last_update_time_ = current_time;
}
scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling*,
@@ -106,4 +123,23 @@ void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) {
tilings_.CloneFrom(other->tilings_);
}
+void PictureLayerImpl::setContentBounds(const gfx::Size& size) {
+ if (contentBounds() != size)
+ last_update_time_ = 0;
+ LayerImpl::setContentBounds(size);
+}
+
+void PictureLayerImpl::setContentsScale(float scaleX, float scaleY) {
+ if (contentsScaleX() != scaleX || contentsScaleY() != scaleY) {
+ last_update_time_ = 0;
+ }
+ LayerImpl::setContentsScale(scaleX, scaleY);
+}
+
+void PictureLayerImpl::setBounds(const gfx::Size& size) {
+ if (bounds() != size)
+ last_update_time_ = 0;
+ LayerImpl::setBounds(size);
+}
+
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698