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 "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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 , m_drawDepth(0) | 52 , m_drawDepth(0) |
53 , m_drawOpacity(0) | 53 , m_drawOpacity(0) |
54 , m_drawOpacityIsAnimating(false) | 54 , m_drawOpacityIsAnimating(false) |
55 , m_filter(0) | 55 , m_filter(0) |
56 , m_drawTransformIsAnimating(false) | 56 , m_drawTransformIsAnimating(false) |
57 , m_screenSpaceTransformIsAnimating(false) | 57 , m_screenSpaceTransformIsAnimating(false) |
58 , m_isClipped(false) | 58 , m_isClipped(false) |
59 #ifndef NDEBUG | 59 #ifndef NDEBUG |
60 , m_betweenWillDrawAndDidDraw(false) | 60 , m_betweenWillDrawAndDidDraw(false) |
61 #endif | 61 #endif |
| 62 , m_numDescendantsThatDrawContent(0) |
62 , m_layerAnimationController(LayerAnimationController::create(this)) | 63 , m_layerAnimationController(LayerAnimationController::create(this)) |
63 { | 64 { |
64 DCHECK(m_layerId > 0); | 65 DCHECK(m_layerId > 0); |
65 } | 66 } |
66 | 67 |
67 LayerImpl::~LayerImpl() | 68 LayerImpl::~LayerImpl() |
68 { | 69 { |
69 #ifndef NDEBUG | 70 #ifndef NDEBUG |
70 DCHECK(!m_betweenWillDrawAndDidDraw); | 71 DCHECK(!m_betweenWillDrawAndDidDraw); |
71 #endif | 72 #endif |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 m_children.clear(); | 106 m_children.clear(); |
106 } | 107 } |
107 | 108 |
108 void LayerImpl::createRenderSurface() | 109 void LayerImpl::createRenderSurface() |
109 { | 110 { |
110 DCHECK(!m_renderSurface); | 111 DCHECK(!m_renderSurface); |
111 m_renderSurface = make_scoped_ptr(new RenderSurfaceImpl(this)); | 112 m_renderSurface = make_scoped_ptr(new RenderSurfaceImpl(this)); |
112 setRenderTarget(this); | 113 setRenderTarget(this); |
113 } | 114 } |
114 | 115 |
115 int LayerImpl::descendantsDrawContent() | |
116 { | |
117 int result = 0; | |
118 for (size_t i = 0; i < m_children.size(); ++i) { | |
119 if (m_children[i]->drawsContent()) | |
120 ++result; | |
121 result += m_children[i]->descendantsDrawContent(); | |
122 if (result > 1) | |
123 return result; | |
124 } | |
125 return result; | |
126 } | |
127 | |
128 scoped_ptr<SharedQuadState> LayerImpl::createSharedQuadState() const | 116 scoped_ptr<SharedQuadState> LayerImpl::createSharedQuadState() const |
129 { | 117 { |
130 scoped_ptr<SharedQuadState> state = SharedQuadState::Create(); | 118 scoped_ptr<SharedQuadState> state = SharedQuadState::Create(); |
131 state->SetAll(m_drawTransform, m_visibleContentRect, m_drawableContentRect, m_
clipRect, m_isClipped, m_drawOpacity); | 119 state->SetAll(m_drawTransform, m_visibleContentRect, m_drawableContentRect, m_
clipRect, m_isClipped, m_drawOpacity); |
132 return state.Pass(); | 120 return state.Pass(); |
133 } | 121 } |
134 | 122 |
135 void LayerImpl::willDraw(ResourceProvider*) | 123 void LayerImpl::willDraw(ResourceProvider*) |
136 { | 124 { |
137 #ifndef NDEBUG | 125 #ifndef NDEBUG |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 | 714 |
727 void LayerImpl::setVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer) | 715 void LayerImpl::setVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer) |
728 { | 716 { |
729 if (!m_scrollbarAnimationController) | 717 if (!m_scrollbarAnimationController) |
730 m_scrollbarAnimationController = ScrollbarAnimationController::create(th
is); | 718 m_scrollbarAnimationController = ScrollbarAnimationController::create(th
is); |
731 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer); | 719 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer); |
732 m_scrollbarAnimationController->updateScrollOffset(this); | 720 m_scrollbarAnimationController->updateScrollOffset(this); |
733 } | 721 } |
734 | 722 |
735 } // namespace cc | 723 } // namespace cc |
OLD | NEW |