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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...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 WebKit::WebTransformationMatrix
&) OVERRIDE; | 54 virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix
&) OVERRIDE; |
53 virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE; | 55 virtual const WebKit::WebTransformationMatrix& 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. | |
101 virtual bool descendantDrawsContent(); | |
102 | |
103 void setAnchorPoint(const gfx::PointF&); | 102 void setAnchorPoint(const gfx::PointF&); |
104 const gfx::PointF& anchorPoint() const { return m_anchorPoint; } | 103 const gfx::PointF& anchorPoint() const { return m_anchorPoint; } |
105 | 104 |
106 void setAnchorPointZ(float); | 105 void setAnchorPointZ(float); |
107 float anchorPointZ() const { return m_anchorPointZ; } | 106 float anchorPointZ() const { return m_anchorPointZ; } |
108 | 107 |
109 void setBackgroundColor(SkColor); | 108 void setBackgroundColor(SkColor); |
110 SkColor backgroundColor() const { return m_backgroundColor; } | 109 SkColor backgroundColor() const { return m_backgroundColor; } |
111 | 110 |
112 void setFilters(const WebKit::WebFilterOperations&); | 111 void setFilters(const WebKit::WebFilterOperations&); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 | 304 |
306 // Note carefully this does not affect the current layer. | 305 // Note carefully this does not affect the current layer. |
307 void noteLayerPropertyChangedForDescendants(); | 306 void noteLayerPropertyChangedForDescendants(); |
308 | 307 |
309 virtual const char* layerTypeAsString() const; | 308 virtual const char* layerTypeAsString() const; |
310 | 309 |
311 void dumpLayer(std::string*, int indent) const; | 310 void dumpLayer(std::string*, int indent) const; |
312 | 311 |
313 // Properties internal to LayerImpl | 312 // Properties internal to LayerImpl |
314 LayerImpl* m_parent; | 313 LayerImpl* m_parent; |
315 ScopedPtrVector<LayerImpl> m_children; | 314 LayerList m_children; |
316 // m_maskLayer can be temporarily stolen during tree sync, we need this ID t
o confirm newly assigned layer is still the previous one | 315 // m_maskLayer can be temporarily stolen during tree sync, we need this ID t
o confirm newly assigned layer is still the previous one |
317 int m_maskLayerId; | 316 int m_maskLayerId; |
318 scoped_ptr<LayerImpl> m_maskLayer; | 317 scoped_ptr<LayerImpl> m_maskLayer; |
319 int m_replicaLayerId; // ditto | 318 int m_replicaLayerId; // ditto |
320 scoped_ptr<LayerImpl> m_replicaLayer; | 319 scoped_ptr<LayerImpl> m_replicaLayer; |
321 int m_layerId; | 320 int m_layerId; |
322 LayerTreeHostImpl* m_layerTreeHostImpl; | 321 LayerTreeHostImpl* m_layerTreeHostImpl; |
323 | 322 |
324 // Properties synchronized from the associated Layer. | 323 // Properties synchronized from the associated Layer. |
325 gfx::PointF m_anchorPoint; | 324 gfx::PointF m_anchorPoint; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 scoped_ptr<ScrollbarAnimationController> m_scrollbarAnimationController; | 423 scoped_ptr<ScrollbarAnimationController> m_scrollbarAnimationController; |
425 | 424 |
426 DISALLOW_COPY_AND_ASSIGN(LayerImpl); | 425 DISALLOW_COPY_AND_ASSIGN(LayerImpl); |
427 }; | 426 }; |
428 | 427 |
429 void sortLayers(std::vector<LayerImpl*>::iterator first, std::vector<LayerImpl*>
::iterator end, LayerSorter*); | 428 void sortLayers(std::vector<LayerImpl*>::iterator first, std::vector<LayerImpl*>
::iterator end, LayerSorter*); |
430 | 429 |
431 } | 430 } |
432 | 431 |
433 #endif // CC_LAYER_IMPL_H_ | 432 #endif // CC_LAYER_IMPL_H_ |
OLD | NEW |