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

Side by Side 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: Added registration/unregistration 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "cc/debug_border_draw_quad.h" 9 #include "cc/debug_border_draw_quad.h"
10 #include "cc/debug_colors.h" 10 #include "cc/debug_colors.h"
(...skipping 20 matching lines...) Expand all
31 , m_contentsScaleY(1.0) 31 , m_contentsScaleY(1.0)
32 , m_scrollable(false) 32 , m_scrollable(false)
33 , m_shouldScrollOnMainThread(false) 33 , m_shouldScrollOnMainThread(false)
34 , m_haveWheelEventHandlers(false) 34 , m_haveWheelEventHandlers(false)
35 , m_backgroundColor(0) 35 , m_backgroundColor(0)
36 , m_doubleSided(true) 36 , m_doubleSided(true)
37 , m_layerPropertyChanged(false) 37 , m_layerPropertyChanged(false)
38 , m_layerSurfacePropertyChanged(false) 38 , m_layerSurfacePropertyChanged(false)
39 , m_masksToBounds(false) 39 , m_masksToBounds(false)
40 , m_contentsOpaque(false) 40 , m_contentsOpaque(false)
41 , m_opacity(1.0)
42 , m_preserves3D(false) 41 , m_preserves3D(false)
43 , m_useParentBackfaceVisibility(false) 42 , m_useParentBackfaceVisibility(false)
44 , m_drawCheckerboardForMissingTiles(false) 43 , m_drawCheckerboardForMissingTiles(false)
45 , m_useLCDText(false) 44 , m_useLCDText(false)
46 , m_drawsContent(false) 45 , m_drawsContent(false)
47 , m_forceRenderSurface(false) 46 , m_forceRenderSurface(false)
48 , m_isContainerForFixedPositionLayers(false) 47 , m_isContainerForFixedPositionLayers(false)
49 , m_fixedToContainerLayer(false) 48 , m_fixedToContainerLayer(false)
50 , m_renderTarget(0) 49 , m_renderTarget(0)
51 , m_drawDepth(0) 50 , m_drawDepth(0)
52 , m_drawOpacity(0) 51 , m_drawOpacity(0)
53 , m_drawOpacityIsAnimating(false) 52 , m_drawOpacityIsAnimating(false)
54 , m_drawTransformIsAnimating(false) 53 , m_drawTransformIsAnimating(false)
55 , m_screenSpaceTransformIsAnimating(false) 54 , m_screenSpaceTransformIsAnimating(false)
56 , m_isClipped(false) 55 , m_isClipped(false)
57 #ifndef NDEBUG 56 #ifndef NDEBUG
58 , m_betweenWillDrawAndDidDraw(false) 57 , m_betweenWillDrawAndDidDraw(false)
59 #endif 58 #endif
60 , m_layerAnimationController(LayerAnimationController::create(this)) 59 , m_layerAnimationController(LayerAnimationController::create())
61 { 60 {
62 DCHECK(m_layerId > 0); 61 DCHECK(m_layerId > 0);
62 m_layerAnimationController->setId(m_layerId);
63 } 63 }
64 64
65 LayerImpl::~LayerImpl() 65 LayerImpl::~LayerImpl()
66 { 66 {
67 #ifndef NDEBUG 67 #ifndef NDEBUG
68 DCHECK(!m_betweenWillDrawAndDidDraw); 68 DCHECK(!m_betweenWillDrawAndDidDraw);
69 #endif 69 #endif
70 } 70 }
71 71
72 void LayerImpl::addChild(scoped_ptr<LayerImpl> child) 72 void LayerImpl::addChild(scoped_ptr<LayerImpl> child)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 for (size_t i = 0; i < m_children.size(); ++i) { 115 for (size_t i = 0; i < m_children.size(); ++i) {
116 if (m_children[i]->drawsContent()) 116 if (m_children[i]->drawsContent())
117 ++result; 117 ++result;
118 result += m_children[i]->descendantsDrawContent(); 118 result += m_children[i]->descendantsDrawContent();
119 if (result > 1) 119 if (result > 1)
120 return result; 120 return result;
121 } 121 }
122 return result; 122 return result;
123 } 123 }
124 124
125 void LayerImpl::setLayerTreeHostImpl(LayerTreeHostImpl* hostImpl)
126 {
127 m_layerTreeHostImpl = hostImpl;
128 m_layerAnimationController->setAnimationRegistrar(hostImpl);
129 }
130
125 scoped_ptr<SharedQuadState> LayerImpl::createSharedQuadState() const 131 scoped_ptr<SharedQuadState> LayerImpl::createSharedQuadState() const
126 { 132 {
127 scoped_ptr<SharedQuadState> state = SharedQuadState::Create(); 133 scoped_ptr<SharedQuadState> state = SharedQuadState::Create();
128 state->SetAll(m_drawTransform, m_visibleContentRect, m_drawableContentRect, m_ clipRect, m_isClipped, m_drawOpacity); 134 state->SetAll(m_drawTransform, m_visibleContentRect, m_drawableContentRect, m_ clipRect, m_isClipped, m_drawOpacity);
129 return state.Pass(); 135 return state.Pass();
130 } 136 }
131 137
132 void LayerImpl::willDraw(ResourceProvider*) 138 void LayerImpl::willDraw(ResourceProvider*)
133 { 139 {
134 #ifndef NDEBUG 140 #ifndef NDEBUG
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 bool LayerImpl::layerIsAlwaysDamaged() const 421 bool LayerImpl::layerIsAlwaysDamaged() const
416 { 422 {
417 return false; 423 return false;
418 } 424 }
419 425
420 int LayerImpl::id() const 426 int LayerImpl::id() const
421 { 427 {
422 return m_layerId; 428 return m_layerId;
423 } 429 }
424 430
425 float LayerImpl::opacity() const
426 {
427 return m_opacity;
428 }
429
430 void LayerImpl::setOpacityFromAnimation(float opacity)
431 {
432 setOpacity(opacity);
433 }
434
435 const gfx::Transform& LayerImpl::transform() const
436 {
437 return m_transform;
438 }
439
440 void LayerImpl::setTransformFromAnimation(const gfx::Transform& transform)
441 {
442 setTransform(transform);
443 }
444
445 void LayerImpl::setBounds(const gfx::Size& bounds) 431 void LayerImpl::setBounds(const gfx::Size& bounds)
446 { 432 {
447 if (m_bounds == bounds) 433 if (m_bounds == bounds)
448 return; 434 return;
449 435
450 m_bounds = bounds; 436 m_bounds = bounds;
451 437
452 if (masksToBounds()) 438 if (masksToBounds())
453 noteLayerPropertyChangedForSubtree(); 439 noteLayerPropertyChangedForSubtree();
454 else 440 else
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 { 543 {
558 if (m_contentsOpaque == opaque) 544 if (m_contentsOpaque == opaque)
559 return; 545 return;
560 546
561 m_contentsOpaque = opaque; 547 m_contentsOpaque = opaque;
562 noteLayerPropertyChangedForSubtree(); 548 noteLayerPropertyChangedForSubtree();
563 } 549 }
564 550
565 void LayerImpl::setOpacity(float opacity) 551 void LayerImpl::setOpacity(float opacity)
566 { 552 {
567 if (m_opacity == opacity) 553 if (!m_layerAnimationController->setOpacity(opacity))
568 return; 554 return;
555 m_layerSurfacePropertyChanged = true;
556 }
569 557
570 m_opacity = opacity; 558 float LayerImpl::opacity() const
571 m_layerSurfacePropertyChanged = true; 559 {
560 return m_layerAnimationController->opacity();
572 } 561 }
573 562
574 bool LayerImpl::opacityIsAnimating() const 563 bool LayerImpl::opacityIsAnimating() const
575 { 564 {
576 return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Opac ity); 565 return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Opac ity);
577 } 566 }
578 567
579 void LayerImpl::setPosition(const gfx::PointF& position) 568 void LayerImpl::setPosition(const gfx::PointF& position)
580 { 569 {
581 if (m_position == position) 570 if (m_position == position)
(...skipping 17 matching lines...) Expand all
599 if (m_sublayerTransform == sublayerTransform) 588 if (m_sublayerTransform == sublayerTransform)
600 return; 589 return;
601 590
602 m_sublayerTransform = sublayerTransform; 591 m_sublayerTransform = sublayerTransform;
603 // sublayer transform does not affect the current layer; it affects only its children. 592 // sublayer transform does not affect the current layer; it affects only its children.
604 noteLayerPropertyChangedForDescendants(); 593 noteLayerPropertyChangedForDescendants();
605 } 594 }
606 595
607 void LayerImpl::setTransform(const gfx::Transform& transform) 596 void LayerImpl::setTransform(const gfx::Transform& transform)
608 { 597 {
609 if (m_transform == transform) 598 if (!m_layerAnimationController->setTransform(transform))
610 return; 599 return;
600 m_layerSurfacePropertyChanged = true;
601 }
611 602
612 m_transform = transform; 603 const gfx::Transform& LayerImpl::transform() const
613 m_layerSurfacePropertyChanged = true; 604 {
605 return m_layerAnimationController->transform();
614 } 606 }
615 607
616 bool LayerImpl::transformIsAnimating() const 608 bool LayerImpl::transformIsAnimating() const
617 { 609 {
618 return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Tran sform); 610 return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Tran sform);
619 } 611 }
620 612
621 void LayerImpl::setContentBounds(const gfx::Size& contentBounds) 613 void LayerImpl::setContentBounds(const gfx::Size& contentBounds)
622 { 614 {
623 if (m_contentBounds == contentBounds) 615 if (m_contentBounds == contentBounds)
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 715
724 void LayerImpl::setVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer) 716 void LayerImpl::setVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer)
725 { 717 {
726 if (!m_scrollbarAnimationController) 718 if (!m_scrollbarAnimationController)
727 m_scrollbarAnimationController = ScrollbarAnimationController::create(th is); 719 m_scrollbarAnimationController = ScrollbarAnimationController::create(th is);
728 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer); 720 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer);
729 m_scrollbarAnimationController->updateScrollOffset(this); 721 m_scrollbarAnimationController->updateScrollOffset(this);
730 } 722 }
731 723
732 } // namespace cc 724 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_impl.h ('k') | cc/layer_tree_host.h » ('j') | cc/layer_tree_host.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698