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 : public LayerAnimationControllerClient { | 41 class CC_EXPORT LayerImpl : public LayerAnimationControllerClient { |
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 // LayerAnimationControllerClient implementation. | 52 // LayerAnimationControllerClient implementation. |
53 virtual int id() const OVERRIDE; | 53 virtual int id() const OVERRIDE; |
54 virtual void setOpacityFromAnimation(float) OVERRIDE; | 54 virtual void setOpacityFromAnimation(float) OVERRIDE; |
55 virtual float opacity() const OVERRIDE; | 55 virtual float opacity() const OVERRIDE; |
56 virtual void setTransformFromAnimation(const gfx::Transform&) OVERRIDE; | 56 virtual void setTransformFromAnimation(const gfx::Transform&) OVERRIDE; |
57 virtual const gfx::Transform& transform() const OVERRIDE; | 57 virtual const gfx::Transform& transform() const OVERRIDE; |
(...skipping 12 matching lines...) Expand all Loading... |
70 | 70 |
71 void setReplicaLayer(scoped_ptr<LayerImpl>); | 71 void setReplicaLayer(scoped_ptr<LayerImpl>); |
72 LayerImpl* replicaLayer() { return m_replicaLayer.get(); } | 72 LayerImpl* replicaLayer() { return m_replicaLayer.get(); } |
73 const LayerImpl* replicaLayer() const { return m_replicaLayer.get(); } | 73 const LayerImpl* replicaLayer() const { return m_replicaLayer.get(); } |
74 | 74 |
75 bool hasMask() const { return m_maskLayer; } | 75 bool hasMask() const { return m_maskLayer; } |
76 bool hasReplica() const { return m_replicaLayer; } | 76 bool hasReplica() const { return m_replicaLayer; } |
77 bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_rep
licaLayer->m_maskLayer); } | 77 bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_rep
licaLayer->m_maskLayer); } |
78 | 78 |
79 LayerTreeHostImpl* layerTreeHostImpl() const { return m_layerTreeHostImpl; } | 79 LayerTreeHostImpl* layerTreeHostImpl() const { return m_layerTreeHostImpl; } |
80 void setLayerTreeHostImpl(LayerTreeHostImpl* hostImpl) { m_layerTreeHostImpl
= hostImpl; } | |
81 | 80 |
82 scoped_ptr<SharedQuadState> createSharedQuadState() const; | 81 scoped_ptr<SharedQuadState> createSharedQuadState() const; |
83 // willDraw must be called before appendQuads. If willDraw is called, | 82 // willDraw must be called before appendQuads. If willDraw is called, |
84 // didDraw is guaranteed to be called before another willDraw or before | 83 // didDraw is guaranteed to be called before another willDraw or before |
85 // the layer is destroyed. To enforce this, any class that overrides | 84 // the layer is destroyed. To enforce this, any class that overrides |
86 // willDraw/didDraw must call the base class version. | 85 // willDraw/didDraw must call the base class version. |
87 virtual void willDraw(ResourceProvider*); | 86 virtual void willDraw(ResourceProvider*); |
88 virtual void appendQuads(QuadSink&, AppendQuadsData&) { } | 87 virtual void appendQuads(QuadSink&, AppendQuadsData&) { } |
89 virtual void didDraw(ResourceProvider*); | 88 virtual void didDraw(ResourceProvider*); |
90 | 89 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 ScrollbarLayerImpl* horizontalScrollbarLayer(); | 271 ScrollbarLayerImpl* horizontalScrollbarLayer(); |
273 const ScrollbarLayerImpl* horizontalScrollbarLayer() const; | 272 const ScrollbarLayerImpl* horizontalScrollbarLayer() const; |
274 | 273 |
275 void setVerticalScrollbarLayer(ScrollbarLayerImpl*); | 274 void setVerticalScrollbarLayer(ScrollbarLayerImpl*); |
276 ScrollbarLayerImpl* verticalScrollbarLayer(); | 275 ScrollbarLayerImpl* verticalScrollbarLayer(); |
277 const ScrollbarLayerImpl* verticalScrollbarLayer() const; | 276 const ScrollbarLayerImpl* verticalScrollbarLayer() const; |
278 | 277 |
279 gfx::Rect layerRectToContentRect(const gfx::RectF& layerRect) const; | 278 gfx::Rect layerRectToContentRect(const gfx::RectF& layerRect) const; |
280 | 279 |
281 protected: | 280 protected: |
282 explicit LayerImpl(int); | 281 LayerImpl(LayerTreeHostImpl* hostImpl, int); |
283 | 282 |
284 // Get the color and size of the layer's debug border. | 283 // Get the color and size of the layer's debug border. |
285 virtual void getDebugBorderProperties(SkColor*, float* width) const; | 284 virtual void getDebugBorderProperties(SkColor*, float* width) const; |
286 | 285 |
287 void appendDebugBorderQuad(QuadSink&, const SharedQuadState*, AppendQuadsDat
a&) const; | 286 void appendDebugBorderQuad(QuadSink&, const SharedQuadState*, AppendQuadsDat
a&) const; |
288 | 287 |
289 virtual void dumpLayerProperties(std::string*, int indent) const; | 288 virtual void dumpLayerProperties(std::string*, int indent) const; |
290 static std::string indentString(int indent); | 289 static std::string indentString(int indent); |
291 | 290 |
292 private: | 291 private: |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 // Group of properties that need to be computed based on the layer tree | 393 // Group of properties that need to be computed based on the layer tree |
395 // hierarchy before layers can be drawn. | 394 // hierarchy before layers can be drawn. |
396 DrawProperties<LayerImpl, RenderSurfaceImpl> m_drawProperties; | 395 DrawProperties<LayerImpl, RenderSurfaceImpl> m_drawProperties; |
397 | 396 |
398 DISALLOW_COPY_AND_ASSIGN(LayerImpl); | 397 DISALLOW_COPY_AND_ASSIGN(LayerImpl); |
399 }; | 398 }; |
400 | 399 |
401 } | 400 } |
402 | 401 |
403 #endif // CC_LAYER_IMPL_H_ | 402 #endif // CC_LAYER_IMPL_H_ |
OLD | NEW |