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 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 setNeedsDisplay(); | 691 setNeedsDisplay(); |
692 } | 692 } |
693 | 693 |
694 void Layer::createRenderSurface() | 694 void Layer::createRenderSurface() |
695 { | 695 { |
696 DCHECK(!m_renderSurface); | 696 DCHECK(!m_renderSurface); |
697 m_renderSurface = make_scoped_ptr(new RenderSurface(this)); | 697 m_renderSurface = make_scoped_ptr(new RenderSurface(this)); |
698 setRenderTarget(this); | 698 setRenderTarget(this); |
699 } | 699 } |
700 | 700 |
701 bool Layer::descendantDrawsContent() | 701 int Layer::descendantsDrawContent() |
702 { | 702 { |
| 703 int result = 0; |
703 for (size_t i = 0; i < m_children.size(); ++i) { | 704 for (size_t i = 0; i < m_children.size(); ++i) { |
704 if (m_children[i]->drawsContent() || m_children[i]->descendantDrawsConte
nt()) | 705 if (m_children[i]->drawsContent()) |
705 return true; | 706 ++result; |
| 707 result += m_children[i]->descendantsDrawContent(); |
| 708 if (result > 1) |
| 709 return result; |
706 } | 710 } |
707 return false; | 711 return result; |
708 } | 712 } |
709 | 713 |
710 int Layer::id() const | 714 int Layer::id() const |
711 { | 715 { |
712 return m_layerId; | 716 return m_layerId; |
713 } | 717 } |
714 | 718 |
715 float Layer::opacity() const | 719 float Layer::opacity() const |
716 { | 720 { |
717 return m_opacity; | 721 return m_opacity; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 { | 838 { |
835 return 0; | 839 return 0; |
836 } | 840 } |
837 | 841 |
838 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) | 842 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) |
839 { | 843 { |
840 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. | 844 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. |
841 } | 845 } |
842 | 846 |
843 } // namespace cc | 847 } // namespace cc |
OLD | NEW |