diff options
author | vollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-07 07:37:08 +0000 |
---|---|---|
committer | vollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-07 07:37:08 +0000 |
commit | 0a9fd4dd4f05423a83479ace4d2b2469eced588e (patch) | |
tree | bf8de741db7e373a398bde755180b926b608c51d /cc/layer_impl.cc | |
parent | 3d871d9695ec44bf3b5cabd09549bd2c1f999eb5 (diff) | |
download | chromium_src-0a9fd4dd4f05423a83479ace4d2b2469eced588e.zip chromium_src-0a9fd4dd4f05423a83479ace4d2b2469eced588e.tar.gz chromium_src-0a9fd4dd4f05423a83479ace4d2b2469eced588e.tar.bz2 |
With this patch we accomplish the following:
1. layer animation controllers are ref counted (so they can be shared by the two impl trees)
2. the layer tree hosts now own a list of active animation controllers. This allows for a couple of nice things
__a. Ticking the animation controllers no longer requires a tree walk
__b. We will be able to support ticking of animation controllers for layers that are not yet added to the layer tree. (Support coming in a future patch).
3. animation controllers register and unregister themselves from their respective layer tree host's list when they have an animation to tick.
BUG=162111
Review URL: https://chromiumcodereview.appspot.com/11348256
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171714 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/layer_impl.cc')
-rw-r--r-- | cc/layer_impl.cc | 48 |
1 files changed, 20 insertions, 28 deletions
diff --git a/cc/layer_impl.cc b/cc/layer_impl.cc index 2b78195..c9c41c1 100644 --- a/cc/layer_impl.cc +++ b/cc/layer_impl.cc @@ -37,7 +37,6 @@ LayerImpl::LayerImpl(int id) , m_layerSurfacePropertyChanged(false) , m_masksToBounds(false) , m_contentsOpaque(false) - , m_opacity(1.0) , m_preserves3D(false) , m_useParentBackfaceVisibility(false) , m_drawCheckerboardForMissingTiles(false) @@ -50,9 +49,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() @@ -115,6 +115,12 @@ int LayerImpl::descendantsDrawContent() return result; } +void LayerImpl::setLayerTreeHostImpl(LayerTreeHostImpl* hostImpl) +{ + m_layerTreeHostImpl = hostImpl; + m_layerAnimationController->setAnimationRegistrar(hostImpl); +} + scoped_ptr<SharedQuadState> LayerImpl::createSharedQuadState() const { scoped_ptr<SharedQuadState> state = SharedQuadState::Create(); @@ -415,26 +421,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) @@ -557,13 +543,16 @@ void LayerImpl::setContentsOpaque(bool opaque) void LayerImpl::setOpacity(float opacity) { - if (m_opacity == opacity) + if (!m_layerAnimationController->setOpacity(opacity)) return; - - m_opacity = opacity; m_layerSurfacePropertyChanged = true; } +float LayerImpl::opacity() const +{ + return m_layerAnimationController->opacity(); +} + bool LayerImpl::opacityIsAnimating() const { return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Opacity); @@ -599,13 +588,16 @@ void LayerImpl::setSublayerTransform(const gfx::Transform& sublayerTransform) void LayerImpl::setTransform(const gfx::Transform& transform) { - if (m_transform == transform) + if (!m_layerAnimationController->setTransform(transform)) return; - - m_transform = transform; m_layerSurfacePropertyChanged = true; } +const gfx::Transform& LayerImpl::transform() const +{ + return m_layerAnimationController->transform(); +} + bool LayerImpl::transformIsAnimating() const { return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Transform); |