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 #ifndef CC_LAYER_IMPL_H_ | 5 #ifndef CC_LAYER_IMPL_H_ |
6 #define CC_LAYER_IMPL_H_ | 6 #define CC_LAYER_IMPL_H_ |
7 | 7 |
8 #include <public/WebFilterOperations.h> | 8 #include <public/WebFilterOperations.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 class QuadSink; | 31 class QuadSink; |
32 class Renderer; | 32 class Renderer; |
33 class ScrollbarAnimationController; | 33 class ScrollbarAnimationController; |
34 class ScrollbarLayerImpl; | 34 class ScrollbarLayerImpl; |
35 class Layer; | 35 class Layer; |
36 | 36 |
37 struct AppendQuadsData; | 37 struct AppendQuadsData; |
38 | 38 |
39 class CC_EXPORT LayerImpl : public LayerAnimationControllerClient { | 39 class CC_EXPORT LayerImpl : public LayerAnimationControllerClient { |
40 public: | 40 public: |
| 41 typedef ScopedPtrVector<LayerImpl> LayerList; |
| 42 |
41 static scoped_ptr<LayerImpl> create(int id) | 43 static scoped_ptr<LayerImpl> create(int id) |
42 { | 44 { |
43 return make_scoped_ptr(new LayerImpl(id)); | 45 return make_scoped_ptr(new LayerImpl(id)); |
44 } | 46 } |
45 | 47 |
46 virtual ~LayerImpl(); | 48 virtual ~LayerImpl(); |
47 | 49 |
48 // LayerAnimationControllerClient implementation. | 50 // LayerAnimationControllerClient implementation. |
49 virtual int id() const OVERRIDE; | 51 virtual int id() const OVERRIDE; |
50 virtual void setOpacityFromAnimation(float) OVERRIDE; | 52 virtual void setOpacityFromAnimation(float) OVERRIDE; |
51 virtual float opacity() const OVERRIDE; | 53 virtual float opacity() const OVERRIDE; |
52 virtual void setTransformFromAnimation(const gfx::Transform&) OVERRIDE; | 54 virtual void setTransformFromAnimation(const gfx::Transform&) OVERRIDE; |
53 virtual const gfx::Transform& transform() const OVERRIDE; | 55 virtual const gfx::Transform& transform() const OVERRIDE; |
54 | 56 |
55 // Tree structure. | 57 // Tree structure. |
56 LayerImpl* parent() { return m_parent; } | 58 LayerImpl* parent() { return m_parent; } |
57 const LayerImpl* parent() const { return m_parent; } | 59 const LayerImpl* parent() const { return m_parent; } |
58 const ScopedPtrVector<LayerImpl>& children() const { return m_children; } | 60 const LayerList& children() const { return m_children; } |
59 void addChild(scoped_ptr<LayerImpl>); | 61 void addChild(scoped_ptr<LayerImpl>); |
60 void removeFromParent(); | 62 void removeFromParent(); |
61 void removeAllChildren(); | 63 void removeAllChildren(); |
62 | 64 |
63 void setMaskLayer(scoped_ptr<LayerImpl>); | 65 void setMaskLayer(scoped_ptr<LayerImpl>); |
64 LayerImpl* maskLayer() { return m_maskLayer.get(); } | 66 LayerImpl* maskLayer() { return m_maskLayer.get(); } |
65 const LayerImpl* maskLayer() const { return m_maskLayer.get(); } | 67 const LayerImpl* maskLayer() const { return m_maskLayer.get(); } |
66 | 68 |
67 void setReplicaLayer(scoped_ptr<LayerImpl>); | 69 void setReplicaLayer(scoped_ptr<LayerImpl>); |
68 LayerImpl* replicaLayer() { return m_replicaLayer.get(); } | 70 LayerImpl* replicaLayer() { return m_replicaLayer.get(); } |
(...skipping 21 matching lines...) Expand all Loading... |
90 virtual RenderPass::Id firstContributingRenderPassId() const; | 92 virtual RenderPass::Id firstContributingRenderPassId() const; |
91 virtual RenderPass::Id nextContributingRenderPassId(RenderPass::Id) const; | 93 virtual RenderPass::Id nextContributingRenderPassId(RenderPass::Id) const; |
92 | 94 |
93 // Returns true if this layer has content to draw. | 95 // Returns true if this layer has content to draw. |
94 void setDrawsContent(bool); | 96 void setDrawsContent(bool); |
95 bool drawsContent() const { return m_drawsContent; } | 97 bool drawsContent() const { return m_drawsContent; } |
96 | 98 |
97 bool forceRenderSurface() const { return m_forceRenderSurface; } | 99 bool forceRenderSurface() const { return m_forceRenderSurface; } |
98 void setForceRenderSurface(bool force) { m_forceRenderSurface = force; } | 100 void setForceRenderSurface(bool force) { m_forceRenderSurface = force; } |
99 | 101 |
100 // Returns true if any of the layer's descendants has content to draw. | 102 // Returns 0 if none of the layer's descendants has content to draw, |
101 virtual bool descendantDrawsContent(); | 103 // 1 if exactly one descendant has content to draw, or a number >1 |
| 104 // (but necessary the exact number of descendants) otherwise. |
| 105 virtual int descendantsDrawContent(); |
102 | 106 |
103 void setAnchorPoint(const gfx::PointF&); | 107 void setAnchorPoint(const gfx::PointF&); |
104 const gfx::PointF& anchorPoint() const { return m_anchorPoint; } | 108 const gfx::PointF& anchorPoint() const { return m_anchorPoint; } |
105 | 109 |
106 void setAnchorPointZ(float); | 110 void setAnchorPointZ(float); |
107 float anchorPointZ() const { return m_anchorPointZ; } | 111 float anchorPointZ() const { return m_anchorPointZ; } |
108 | 112 |
109 void setBackgroundColor(SkColor); | 113 void setBackgroundColor(SkColor); |
110 SkColor backgroundColor() const { return m_backgroundColor; } | 114 SkColor backgroundColor() const { return m_backgroundColor; } |
111 | 115 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 | 311 |
308 // Note carefully this does not affect the current layer. | 312 // Note carefully this does not affect the current layer. |
309 void noteLayerPropertyChangedForDescendants(); | 313 void noteLayerPropertyChangedForDescendants(); |
310 | 314 |
311 virtual const char* layerTypeAsString() const; | 315 virtual const char* layerTypeAsString() const; |
312 | 316 |
313 void dumpLayer(std::string*, int indent) const; | 317 void dumpLayer(std::string*, int indent) const; |
314 | 318 |
315 // Properties internal to LayerImpl | 319 // Properties internal to LayerImpl |
316 LayerImpl* m_parent; | 320 LayerImpl* m_parent; |
317 ScopedPtrVector<LayerImpl> m_children; | 321 LayerList m_children; |
318 // m_maskLayer can be temporarily stolen during tree sync, we need this ID t
o confirm newly assigned layer is still the previous one | 322 // m_maskLayer can be temporarily stolen during tree sync, we need this ID t
o confirm newly assigned layer is still the previous one |
319 int m_maskLayerId; | 323 int m_maskLayerId; |
320 scoped_ptr<LayerImpl> m_maskLayer; | 324 scoped_ptr<LayerImpl> m_maskLayer; |
321 int m_replicaLayerId; // ditto | 325 int m_replicaLayerId; // ditto |
322 scoped_ptr<LayerImpl> m_replicaLayer; | 326 scoped_ptr<LayerImpl> m_replicaLayer; |
323 int m_layerId; | 327 int m_layerId; |
324 LayerTreeHostImpl* m_layerTreeHostImpl; | 328 LayerTreeHostImpl* m_layerTreeHostImpl; |
325 | 329 |
326 // Properties synchronized from the associated Layer. | 330 // Properties synchronized from the associated Layer. |
327 gfx::PointF m_anchorPoint; | 331 gfx::PointF m_anchorPoint; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 scoped_ptr<ScrollbarAnimationController> m_scrollbarAnimationController; | 430 scoped_ptr<ScrollbarAnimationController> m_scrollbarAnimationController; |
427 | 431 |
428 DISALLOW_COPY_AND_ASSIGN(LayerImpl); | 432 DISALLOW_COPY_AND_ASSIGN(LayerImpl); |
429 }; | 433 }; |
430 | 434 |
431 void sortLayers(std::vector<LayerImpl*>::iterator first, std::vector<LayerImpl*>
::iterator end, LayerSorter*); | 435 void sortLayers(std::vector<LayerImpl*>::iterator first, std::vector<LayerImpl*>
::iterator end, LayerSorter*); |
432 | 436 |
433 } | 437 } |
434 | 438 |
435 #endif // CC_LAYER_IMPL_H_ | 439 #endif // CC_LAYER_IMPL_H_ |
OLD | NEW |