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 24 matching lines...) Expand all Loading... |
35 class ScrollbarAnimationController; | 35 class ScrollbarAnimationController; |
36 class ScrollbarLayerImpl; | 36 class ScrollbarLayerImpl; |
37 class Layer; | 37 class Layer; |
38 | 38 |
39 struct AppendQuadsData; | 39 struct AppendQuadsData; |
40 | 40 |
41 class CC_EXPORT LayerImpl { | 41 class CC_EXPORT LayerImpl { |
42 public: | 42 public: |
43 typedef ScopedPtrVector<LayerImpl> LayerList; | 43 typedef ScopedPtrVector<LayerImpl> LayerList; |
44 | 44 |
45 static scoped_ptr<LayerImpl> create(int id) | 45 static scoped_ptr<LayerImpl> create(LayerTreeHostImpl* hostImpl, int id) |
46 { | 46 { |
47 return make_scoped_ptr(new LayerImpl(id)); | 47 return make_scoped_ptr(new LayerImpl(hostImpl, id)); |
48 } | 48 } |
49 | 49 |
50 virtual ~LayerImpl(); | 50 virtual ~LayerImpl(); |
51 | 51 |
52 int id() const; | 52 int id() const; |
53 | 53 |
54 // Tree structure. | 54 // Tree structure. |
55 LayerImpl* parent() { return m_parent; } | 55 LayerImpl* parent() { return m_parent; } |
56 const LayerImpl* parent() const { return m_parent; } | 56 const LayerImpl* parent() const { return m_parent; } |
57 const LayerList& children() const { return m_children; } | 57 const LayerList& children() const { return m_children; } |
58 void addChild(scoped_ptr<LayerImpl>); | 58 void addChild(scoped_ptr<LayerImpl>); |
59 void removeFromParent(); | 59 void removeFromParent(); |
60 void removeAllChildren(); | 60 void removeAllChildren(); |
61 | 61 |
62 void setMaskLayer(scoped_ptr<LayerImpl>); | 62 void setMaskLayer(scoped_ptr<LayerImpl>); |
63 LayerImpl* maskLayer() { return m_maskLayer.get(); } | 63 LayerImpl* maskLayer() { return m_maskLayer.get(); } |
64 const LayerImpl* maskLayer() const { return m_maskLayer.get(); } | 64 const LayerImpl* maskLayer() const { return m_maskLayer.get(); } |
65 | 65 |
66 void setReplicaLayer(scoped_ptr<LayerImpl>); | 66 void setReplicaLayer(scoped_ptr<LayerImpl>); |
67 LayerImpl* replicaLayer() { return m_replicaLayer.get(); } | 67 LayerImpl* replicaLayer() { return m_replicaLayer.get(); } |
68 const LayerImpl* replicaLayer() const { return m_replicaLayer.get(); } | 68 const LayerImpl* replicaLayer() const { return m_replicaLayer.get(); } |
69 | 69 |
70 bool hasMask() const { return m_maskLayer; } | 70 bool hasMask() const { return m_maskLayer; } |
71 bool hasReplica() const { return m_replicaLayer; } | 71 bool hasReplica() const { return m_replicaLayer; } |
72 bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_rep
licaLayer->m_maskLayer); } | 72 bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_rep
licaLayer->m_maskLayer); } |
73 | 73 |
74 LayerTreeHostImpl* layerTreeHostImpl() const { return m_layerTreeHostImpl; } | 74 LayerTreeHostImpl* layerTreeHostImpl() const { return m_layerTreeHostImpl; } |
75 void setLayerTreeHostImpl(LayerTreeHostImpl* hostImpl); | |
76 | 75 |
77 scoped_ptr<SharedQuadState> createSharedQuadState() const; | 76 scoped_ptr<SharedQuadState> createSharedQuadState() const; |
78 // willDraw must be called before appendQuads. If willDraw is called, | 77 // willDraw must be called before appendQuads. If willDraw is called, |
79 // didDraw is guaranteed to be called before another willDraw or before | 78 // didDraw is guaranteed to be called before another willDraw or before |
80 // the layer is destroyed. To enforce this, any class that overrides | 79 // the layer is destroyed. To enforce this, any class that overrides |
81 // willDraw/didDraw must call the base class version. | 80 // willDraw/didDraw must call the base class version. |
82 virtual void willDraw(ResourceProvider*); | 81 virtual void willDraw(ResourceProvider*); |
83 virtual void appendQuads(QuadSink&, AppendQuadsData&) { } | 82 virtual void appendQuads(QuadSink&, AppendQuadsData&) { } |
84 virtual void didDraw(ResourceProvider*); | 83 virtual void didDraw(ResourceProvider*); |
85 | 84 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 ScrollbarLayerImpl* horizontalScrollbarLayer(); | 268 ScrollbarLayerImpl* horizontalScrollbarLayer(); |
270 const ScrollbarLayerImpl* horizontalScrollbarLayer() const; | 269 const ScrollbarLayerImpl* horizontalScrollbarLayer() const; |
271 | 270 |
272 void setVerticalScrollbarLayer(ScrollbarLayerImpl*); | 271 void setVerticalScrollbarLayer(ScrollbarLayerImpl*); |
273 ScrollbarLayerImpl* verticalScrollbarLayer(); | 272 ScrollbarLayerImpl* verticalScrollbarLayer(); |
274 const ScrollbarLayerImpl* verticalScrollbarLayer() const; | 273 const ScrollbarLayerImpl* verticalScrollbarLayer() const; |
275 | 274 |
276 gfx::Rect layerRectToContentRect(const gfx::RectF& layerRect) const; | 275 gfx::Rect layerRectToContentRect(const gfx::RectF& layerRect) const; |
277 | 276 |
278 protected: | 277 protected: |
279 explicit LayerImpl(int); | 278 LayerImpl(LayerTreeHostImpl* hostImpl, int); |
280 | 279 |
281 // Get the color and size of the layer's debug border. | 280 // Get the color and size of the layer's debug border. |
282 virtual void getDebugBorderProperties(SkColor*, float* width) const; | 281 virtual void getDebugBorderProperties(SkColor*, float* width) const; |
283 | 282 |
284 void appendDebugBorderQuad(QuadSink&, const SharedQuadState*, AppendQuadsDat
a&) const; | 283 void appendDebugBorderQuad(QuadSink&, const SharedQuadState*, AppendQuadsDat
a&) const; |
285 | 284 |
286 virtual void dumpLayerProperties(std::string*, int indent) const; | 285 virtual void dumpLayerProperties(std::string*, int indent) const; |
287 static std::string indentString(int indent); | 286 static std::string indentString(int indent); |
288 | 287 |
289 private: | 288 private: |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 // Group of properties that need to be computed based on the layer tree | 388 // Group of properties that need to be computed based on the layer tree |
390 // hierarchy before layers can be drawn. | 389 // hierarchy before layers can be drawn. |
391 DrawProperties<LayerImpl, RenderSurfaceImpl> m_drawProperties; | 390 DrawProperties<LayerImpl, RenderSurfaceImpl> m_drawProperties; |
392 | 391 |
393 DISALLOW_COPY_AND_ASSIGN(LayerImpl); | 392 DISALLOW_COPY_AND_ASSIGN(LayerImpl); |
394 }; | 393 }; |
395 | 394 |
396 } | 395 } |
397 | 396 |
398 #endif // CC_LAYER_IMPL_H_ | 397 #endif // CC_LAYER_IMPL_H_ |
OLD | NEW |