OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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.h" | 5 #include "cc/layer.h" |
6 | 6 |
7 #include "cc/active_animation.h" | 7 #include "cc/active_animation.h" |
8 #include "cc/animation_events.h" | 8 #include "cc/animation_events.h" |
9 #include "cc/layer_animation_controller.h" | 9 #include "cc/layer_animation_controller.h" |
10 #include "cc/layer_impl.h" | 10 #include "cc/layer_impl.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 , m_replicaLayer(0) | 57 , m_replicaLayer(0) |
58 , m_drawOpacity(0) | 58 , m_drawOpacity(0) |
59 , m_drawOpacityIsAnimating(false) | 59 , m_drawOpacityIsAnimating(false) |
60 , m_renderTarget(0) | 60 , m_renderTarget(0) |
61 , m_drawTransformIsAnimating(false) | 61 , m_drawTransformIsAnimating(false) |
62 , m_screenSpaceTransformIsAnimating(false) | 62 , m_screenSpaceTransformIsAnimating(false) |
63 , m_isClipped(false) | 63 , m_isClipped(false) |
64 , m_rasterScale(1.0) | 64 , m_rasterScale(1.0) |
65 , m_automaticallyComputeRasterScale(false) | 65 , m_automaticallyComputeRasterScale(false) |
66 , m_boundsContainPageScale(false) | 66 , m_boundsContainPageScale(false) |
| 67 , m_numDescendantsThatDrawContent(0) |
67 , m_layerAnimationDelegate(0) | 68 , m_layerAnimationDelegate(0) |
68 , m_layerScrollClient(0) | 69 , m_layerScrollClient(0) |
69 { | 70 { |
70 if (m_layerId < 0) { | 71 if (m_layerId < 0) { |
71 s_nextLayerId = 1; | 72 s_nextLayerId = 1; |
72 m_layerId = s_nextLayerId++; | 73 m_layerId = s_nextLayerId++; |
73 } | 74 } |
74 } | 75 } |
75 | 76 |
76 Layer::~Layer() | 77 Layer::~Layer() |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 setNeedsDisplay(); | 692 setNeedsDisplay(); |
692 } | 693 } |
693 | 694 |
694 void Layer::createRenderSurface() | 695 void Layer::createRenderSurface() |
695 { | 696 { |
696 DCHECK(!m_renderSurface); | 697 DCHECK(!m_renderSurface); |
697 m_renderSurface = make_scoped_ptr(new RenderSurface(this)); | 698 m_renderSurface = make_scoped_ptr(new RenderSurface(this)); |
698 setRenderTarget(this); | 699 setRenderTarget(this); |
699 } | 700 } |
700 | 701 |
701 int Layer::descendantsDrawContent() | |
702 { | |
703 int result = 0; | |
704 for (size_t i = 0; i < m_children.size(); ++i) { | |
705 if (m_children[i]->drawsContent()) | |
706 ++result; | |
707 result += m_children[i]->descendantsDrawContent(); | |
708 if (result > 1) | |
709 return result; | |
710 } | |
711 return result; | |
712 } | |
713 | |
714 int Layer::id() const | 702 int Layer::id() const |
715 { | 703 { |
716 return m_layerId; | 704 return m_layerId; |
717 } | 705 } |
718 | 706 |
719 float Layer::opacity() const | 707 float Layer::opacity() const |
720 { | 708 { |
721 return m_opacity; | 709 return m_opacity; |
722 } | 710 } |
723 | 711 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 { | 826 { |
839 return 0; | 827 return 0; |
840 } | 828 } |
841 | 829 |
842 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) | 830 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) |
843 { | 831 { |
844 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. | 832 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. |
845 } | 833 } |
846 | 834 |
847 } // namespace cc | 835 } // namespace cc |
OLD | NEW |