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

Unified Diff: cc/layer_impl.cc

Issue 11348256: Use an auxiliary list of animation controllers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Unit tests pass! 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/layer_impl.cc
diff --git a/cc/layer_impl.cc b/cc/layer_impl.cc
index 81bc49f01aafb4a2ea926f0412e3764a5c786d8a..e9f71d43d391e3f4e1ceafe4fa1f393b8b1166ad 100644
--- a/cc/layer_impl.cc
+++ b/cc/layer_impl.cc
@@ -59,9 +59,10 @@ LayerImpl::LayerImpl(int id)
#ifndef NDEBUG
, m_betweenWillDrawAndDidDraw(false)
#endif
- , m_layerAnimationController(LayerAnimationController::create(this))
+ , m_layerAnimationController(LayerAnimationController::create())
{
DCHECK(m_layerId > 0);
+ m_layerAnimationController->setId(m_layerId);
}
LayerImpl::~LayerImpl()
@@ -121,6 +122,12 @@ bool LayerImpl::descendantDrawsContent()
return false;
}
+void LayerImpl::setLayerTreeHostImpl(LayerTreeHostImpl* hostImpl)
+{
+ m_layerTreeHostImpl = hostImpl;
+ m_layerAnimationController->setAnimationRegistrar(hostImpl);
+}
+
scoped_ptr<SharedQuadState> LayerImpl::createSharedQuadState() const
{
scoped_ptr<SharedQuadState> state = SharedQuadState::Create();
@@ -421,26 +428,6 @@ int LayerImpl::id() const
return m_layerId;
}
-float LayerImpl::opacity() const
-{
- return m_opacity;
-}
-
-void LayerImpl::setOpacityFromAnimation(float opacity)
-{
- setOpacity(opacity);
-}
-
-const gfx::Transform& LayerImpl::transform() const
-{
- return m_transform;
-}
-
-void LayerImpl::setTransformFromAnimation(const gfx::Transform& transform)
-{
- setTransform(transform);
-}
-
void LayerImpl::setBounds(const gfx::Size& bounds)
{
if (m_bounds == bounds)
@@ -567,9 +554,17 @@ void LayerImpl::setOpacity(float opacity)
return;
m_opacity = opacity;
+ m_opacityLastUpdateTime = base::TimeTicks::Now();
m_layerSurfacePropertyChanged = true;
}
+float LayerImpl::opacity() const
+{
+ if (m_layerAnimationController->opacityLastUpdateTime() > m_opacityLastUpdateTime)
+ return m_layerAnimationController->opacity();
+ return m_opacity;
+}
+
bool LayerImpl::opacityIsAnimating() const
{
return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Opacity);
@@ -609,9 +604,17 @@ void LayerImpl::setTransform(const gfx::Transform& transform)
return;
m_transform = transform;
+ m_transformLastUpdateTime = base::TimeTicks::Now();
m_layerSurfacePropertyChanged = true;
}
+const gfx::Transform& LayerImpl::transform() const
+{
+ if (m_layerAnimationController->transformLastUpdateTime() > m_transformLastUpdateTime)
+ return m_layerAnimationController->transform();
+ return m_transform;
+}
+
bool LayerImpl::transformIsAnimating() const
{
return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Transform);

Powered by Google App Engine
This is Rietveld 408576698