| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/layer_impl.h" | 5 #include "cc/layer_impl.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "cc/debug_border_draw_quad.h" | 10 #include "cc/debug_border_draw_quad.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 , m_useParentBackfaceVisibility(false) | 43 , m_useParentBackfaceVisibility(false) |
| 44 , m_drawCheckerboardForMissingTiles(false) | 44 , m_drawCheckerboardForMissingTiles(false) |
| 45 , m_drawsContent(false) | 45 , m_drawsContent(false) |
| 46 , m_forceRenderSurface(false) | 46 , m_forceRenderSurface(false) |
| 47 , m_isContainerForFixedPositionLayers(false) | 47 , m_isContainerForFixedPositionLayers(false) |
| 48 , m_fixedToContainerLayer(false) | 48 , m_fixedToContainerLayer(false) |
| 49 , m_drawDepth(0) | 49 , m_drawDepth(0) |
| 50 #ifndef NDEBUG | 50 #ifndef NDEBUG |
| 51 , m_betweenWillDrawAndDidDraw(false) | 51 , m_betweenWillDrawAndDidDraw(false) |
| 52 #endif | 52 #endif |
| 53 , m_layerAnimationController(LayerAnimationController::create(this)) | |
| 54 { | 53 { |
| 55 DCHECK(m_layerId > 0); | 54 DCHECK(m_layerId > 0); |
| 56 DCHECK(m_layerTreeImpl); | 55 DCHECK(m_layerTreeImpl); |
| 57 m_layerTreeImpl->RegisterLayer(this); | 56 m_layerTreeImpl->RegisterLayer(this); |
| 57 AnimationRegistrar* registrar = m_layerTreeImpl; |
| 58 m_layerAnimationController = registrar->GetAnimationControllerForId(m_layerI
d); |
| 59 m_layerAnimationController->addObserver(this); |
| 58 } | 60 } |
| 59 | 61 |
| 60 LayerImpl::~LayerImpl() | 62 LayerImpl::~LayerImpl() |
| 61 { | 63 { |
| 62 #ifndef NDEBUG | 64 #ifndef NDEBUG |
| 63 DCHECK(!m_betweenWillDrawAndDidDraw); | 65 DCHECK(!m_betweenWillDrawAndDidDraw); |
| 64 #endif | 66 #endif |
| 65 m_layerTreeImpl->UnregisterLayer(this); | 67 m_layerTreeImpl->UnregisterLayer(this); |
| 68 m_layerAnimationController->removeObserver(this); |
| 66 } | 69 } |
| 67 | 70 |
| 68 void LayerImpl::addChild(scoped_ptr<LayerImpl> child) | 71 void LayerImpl::addChild(scoped_ptr<LayerImpl> child) |
| 69 { | 72 { |
| 70 child->setParent(this); | 73 child->setParent(this); |
| 71 DCHECK_EQ(layerTreeImpl(), child->layerTreeImpl()); | 74 DCHECK_EQ(layerTreeImpl(), child->layerTreeImpl()); |
| 72 m_children.append(child.Pass()); | 75 m_children.append(child.Pass()); |
| 73 layerTreeImpl()->SetNeedsUpdateDrawProperties(); | 76 layerTreeImpl()->SetNeedsUpdateDrawProperties(); |
| 74 } | 77 } |
| 75 | 78 |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 bool LayerImpl::layerIsAlwaysDamaged() const | 455 bool LayerImpl::layerIsAlwaysDamaged() const |
| 453 { | 456 { |
| 454 return false; | 457 return false; |
| 455 } | 458 } |
| 456 | 459 |
| 457 int LayerImpl::id() const | 460 int LayerImpl::id() const |
| 458 { | 461 { |
| 459 return m_layerId; | 462 return m_layerId; |
| 460 } | 463 } |
| 461 | 464 |
| 462 float LayerImpl::opacity() const | 465 void LayerImpl::OnOpacityAnimated(float opacity) |
| 463 { | |
| 464 return m_opacity; | |
| 465 } | |
| 466 | |
| 467 void LayerImpl::setOpacityFromAnimation(float opacity) | |
| 468 { | 466 { |
| 469 setOpacity(opacity); | 467 setOpacity(opacity); |
| 470 } | 468 } |
| 471 | 469 |
| 472 const gfx::Transform& LayerImpl::transform() const | 470 void LayerImpl::OnTransformAnimated(const gfx::Transform& transform) |
| 473 { | |
| 474 return m_transform; | |
| 475 } | |
| 476 | |
| 477 void LayerImpl::setTransformFromAnimation(const gfx::Transform& transform) | |
| 478 { | 471 { |
| 479 setTransform(transform); | 472 setTransform(transform); |
| 480 } | 473 } |
| 481 | 474 |
| 482 void LayerImpl::setBounds(const gfx::Size& bounds) | 475 void LayerImpl::setBounds(const gfx::Size& bounds) |
| 483 { | 476 { |
| 484 if (m_bounds == bounds) | 477 if (m_bounds == bounds) |
| 485 return; | 478 return; |
| 486 | 479 |
| 487 m_bounds = bounds; | 480 m_bounds = bounds; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 | 612 |
| 620 void LayerImpl::setOpacity(float opacity) | 613 void LayerImpl::setOpacity(float opacity) |
| 621 { | 614 { |
| 622 if (m_opacity == opacity) | 615 if (m_opacity == opacity) |
| 623 return; | 616 return; |
| 624 | 617 |
| 625 m_opacity = opacity; | 618 m_opacity = opacity; |
| 626 noteLayerSurfacePropertyChanged(); | 619 noteLayerSurfacePropertyChanged(); |
| 627 } | 620 } |
| 628 | 621 |
| 622 float LayerImpl::opacity() const |
| 623 { |
| 624 return m_opacity; |
| 625 } |
| 626 |
| 629 bool LayerImpl::opacityIsAnimating() const | 627 bool LayerImpl::opacityIsAnimating() const |
| 630 { | 628 { |
| 631 return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Opac
ity); | 629 return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Opac
ity); |
| 632 } | 630 } |
| 633 | 631 |
| 634 void LayerImpl::setPosition(const gfx::PointF& position) | 632 void LayerImpl::setPosition(const gfx::PointF& position) |
| 635 { | 633 { |
| 636 if (m_position == position) | 634 if (m_position == position) |
| 637 return; | 635 return; |
| 638 | 636 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 661 | 659 |
| 662 void LayerImpl::setTransform(const gfx::Transform& transform) | 660 void LayerImpl::setTransform(const gfx::Transform& transform) |
| 663 { | 661 { |
| 664 if (m_transform == transform) | 662 if (m_transform == transform) |
| 665 return; | 663 return; |
| 666 | 664 |
| 667 m_transform = transform; | 665 m_transform = transform; |
| 668 noteLayerSurfacePropertyChanged(); | 666 noteLayerSurfacePropertyChanged(); |
| 669 } | 667 } |
| 670 | 668 |
| 669 const gfx::Transform& LayerImpl::transform() const |
| 670 { |
| 671 return m_transform; |
| 672 } |
| 673 |
| 671 bool LayerImpl::transformIsAnimating() const | 674 bool LayerImpl::transformIsAnimating() const |
| 672 { | 675 { |
| 673 return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Tran
sform); | 676 return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Tran
sform); |
| 674 } | 677 } |
| 675 | 678 |
| 676 void LayerImpl::setContentBounds(const gfx::Size& contentBounds) | 679 void LayerImpl::setContentBounds(const gfx::Size& contentBounds) |
| 677 { | 680 { |
| 678 if (this->contentBounds() == contentBounds) | 681 if (this->contentBounds() == contentBounds) |
| 679 return; | 682 return; |
| 680 | 683 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 | 785 |
| 783 void LayerImpl::setVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer) | 786 void LayerImpl::setVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer) |
| 784 { | 787 { |
| 785 if (!m_scrollbarAnimationController) | 788 if (!m_scrollbarAnimationController) |
| 786 m_scrollbarAnimationController = ScrollbarAnimationController::create(th
is); | 789 m_scrollbarAnimationController = ScrollbarAnimationController::create(th
is); |
| 787 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer); | 790 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer); |
| 788 m_scrollbarAnimationController->updateScrollOffset(this); | 791 m_scrollbarAnimationController->updateScrollOffset(this); |
| 789 } | 792 } |
| 790 | 793 |
| 791 } // namespace cc | 794 } // namespace cc |
| OLD | NEW |