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 16 matching lines...) Expand all Loading... |
27 #include "ui/gfx/rect_f.h" | 27 #include "ui/gfx/rect_f.h" |
28 #include "ui/gfx/transform.h" | 28 #include "ui/gfx/transform.h" |
29 | 29 |
30 namespace base { | 30 namespace base { |
31 class DictionaryValue; | 31 class DictionaryValue; |
32 } | 32 } |
33 | 33 |
34 namespace cc { | 34 namespace cc { |
35 | 35 |
36 class LayerTreeHostImpl; | 36 class LayerTreeHostImpl; |
| 37 class LayerTreeImpl; |
37 class QuadSink; | 38 class QuadSink; |
38 class Renderer; | 39 class Renderer; |
39 class ScrollbarAnimationController; | 40 class ScrollbarAnimationController; |
40 class ScrollbarLayerImpl; | 41 class ScrollbarLayerImpl; |
41 class Layer; | 42 class Layer; |
42 | 43 |
43 struct AppendQuadsData; | 44 struct AppendQuadsData; |
44 | 45 |
45 class CC_EXPORT LayerImpl : public LayerAnimationControllerClient { | 46 class CC_EXPORT LayerImpl : public LayerAnimationControllerClient { |
46 public: | 47 public: |
47 typedef ScopedPtrVector<LayerImpl> LayerList; | 48 typedef ScopedPtrVector<LayerImpl> LayerList; |
48 | 49 |
49 static scoped_ptr<LayerImpl> create(LayerTreeHostImpl* hostImpl, int id) | 50 static scoped_ptr<LayerImpl> create(LayerTreeImpl* treeImpl, int id) |
50 { | 51 { |
51 return make_scoped_ptr(new LayerImpl(hostImpl, id)); | 52 return make_scoped_ptr(new LayerImpl(treeImpl, id)); |
52 } | 53 } |
53 | 54 |
54 virtual ~LayerImpl(); | 55 virtual ~LayerImpl(); |
55 | 56 |
56 // LayerAnimationControllerClient implementation. | 57 // LayerAnimationControllerClient implementation. |
57 virtual int id() const OVERRIDE; | 58 virtual int id() const OVERRIDE; |
58 virtual void setOpacityFromAnimation(float) OVERRIDE; | 59 virtual void setOpacityFromAnimation(float) OVERRIDE; |
59 virtual float opacity() const OVERRIDE; | 60 virtual float opacity() const OVERRIDE; |
60 virtual void setTransformFromAnimation(const gfx::Transform&) OVERRIDE; | 61 virtual void setTransformFromAnimation(const gfx::Transform&) OVERRIDE; |
61 virtual const gfx::Transform& transform() const OVERRIDE; | 62 virtual const gfx::Transform& transform() const OVERRIDE; |
(...skipping 11 matching lines...) Expand all Loading... |
73 const LayerImpl* maskLayer() const { return m_maskLayer.get(); } | 74 const LayerImpl* maskLayer() const { return m_maskLayer.get(); } |
74 | 75 |
75 void setReplicaLayer(scoped_ptr<LayerImpl>); | 76 void setReplicaLayer(scoped_ptr<LayerImpl>); |
76 LayerImpl* replicaLayer() { return m_replicaLayer.get(); } | 77 LayerImpl* replicaLayer() { return m_replicaLayer.get(); } |
77 const LayerImpl* replicaLayer() const { return m_replicaLayer.get(); } | 78 const LayerImpl* replicaLayer() const { return m_replicaLayer.get(); } |
78 | 79 |
79 bool hasMask() const { return m_maskLayer; } | 80 bool hasMask() const { return m_maskLayer; } |
80 bool hasReplica() const { return m_replicaLayer; } | 81 bool hasReplica() const { return m_replicaLayer; } |
81 bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_rep
licaLayer->m_maskLayer); } | 82 bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_rep
licaLayer->m_maskLayer); } |
82 | 83 |
83 LayerTreeHostImpl* layerTreeHostImpl() const { return m_layerTreeHostImpl; } | 84 LayerTreeImpl* layerTreeImpl() const { return m_layerTreeImpl; } |
| 85 LayerTreeHostImpl* layerTreeHostImpl() const; |
84 | 86 |
85 scoped_ptr<SharedQuadState> createSharedQuadState() const; | 87 scoped_ptr<SharedQuadState> createSharedQuadState() const; |
86 // willDraw must be called before appendQuads. If willDraw is called, | 88 // willDraw must be called before appendQuads. If willDraw is called, |
87 // didDraw is guaranteed to be called before another willDraw or before | 89 // didDraw is guaranteed to be called before another willDraw or before |
88 // the layer is destroyed. To enforce this, any class that overrides | 90 // the layer is destroyed. To enforce this, any class that overrides |
89 // willDraw/didDraw must call the base class version. | 91 // willDraw/didDraw must call the base class version. |
90 virtual void willDraw(ResourceProvider*); | 92 virtual void willDraw(ResourceProvider*); |
91 virtual void appendQuads(QuadSink&, AppendQuadsData&) { } | 93 virtual void appendQuads(QuadSink&, AppendQuadsData&) { } |
92 virtual void didDraw(ResourceProvider*); | 94 virtual void didDraw(ResourceProvider*); |
93 | 95 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 ScrollbarLayerImpl* horizontalScrollbarLayer(); | 281 ScrollbarLayerImpl* horizontalScrollbarLayer(); |
280 const ScrollbarLayerImpl* horizontalScrollbarLayer() const; | 282 const ScrollbarLayerImpl* horizontalScrollbarLayer() const; |
281 | 283 |
282 void setVerticalScrollbarLayer(ScrollbarLayerImpl*); | 284 void setVerticalScrollbarLayer(ScrollbarLayerImpl*); |
283 ScrollbarLayerImpl* verticalScrollbarLayer(); | 285 ScrollbarLayerImpl* verticalScrollbarLayer(); |
284 const ScrollbarLayerImpl* verticalScrollbarLayer() const; | 286 const ScrollbarLayerImpl* verticalScrollbarLayer() const; |
285 | 287 |
286 gfx::Rect layerRectToContentRect(const gfx::RectF& layerRect) const; | 288 gfx::Rect layerRectToContentRect(const gfx::RectF& layerRect) const; |
287 | 289 |
288 protected: | 290 protected: |
289 LayerImpl(LayerTreeHostImpl* hostImpl, int); | 291 LayerImpl(LayerTreeImpl* layerImpl, int); |
290 | 292 |
291 // Get the color and size of the layer's debug border. | 293 // Get the color and size of the layer's debug border. |
292 virtual void getDebugBorderProperties(SkColor*, float* width) const; | 294 virtual void getDebugBorderProperties(SkColor*, float* width) const; |
293 | 295 |
294 void appendDebugBorderQuad(QuadSink&, const SharedQuadState*, AppendQuadsDat
a&) const; | 296 void appendDebugBorderQuad(QuadSink&, const SharedQuadState*, AppendQuadsDat
a&) const; |
295 | 297 |
296 virtual void dumpLayerProperties(std::string*, int indent) const; | 298 virtual void dumpLayerProperties(std::string*, int indent) const; |
297 static std::string indentString(int indent); | 299 static std::string indentString(int indent); |
298 | 300 |
299 private: | 301 private: |
(...skipping 14 matching lines...) Expand all Loading... |
314 | 316 |
315 // Properties internal to LayerImpl | 317 // Properties internal to LayerImpl |
316 LayerImpl* m_parent; | 318 LayerImpl* m_parent; |
317 LayerList m_children; | 319 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 | 320 // 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; | 321 int m_maskLayerId; |
320 scoped_ptr<LayerImpl> m_maskLayer; | 322 scoped_ptr<LayerImpl> m_maskLayer; |
321 int m_replicaLayerId; // ditto | 323 int m_replicaLayerId; // ditto |
322 scoped_ptr<LayerImpl> m_replicaLayer; | 324 scoped_ptr<LayerImpl> m_replicaLayer; |
323 int m_layerId; | 325 int m_layerId; |
324 LayerTreeHostImpl* m_layerTreeHostImpl; | 326 LayerTreeImpl* m_layerTreeImpl; |
325 | 327 |
326 // Properties synchronized from the associated Layer. | 328 // Properties synchronized from the associated Layer. |
327 gfx::PointF m_anchorPoint; | 329 gfx::PointF m_anchorPoint; |
328 float m_anchorPointZ; | 330 float m_anchorPointZ; |
329 gfx::Size m_bounds; | 331 gfx::Size m_bounds; |
330 gfx::Size m_contentBounds; | 332 gfx::Size m_contentBounds; |
331 float m_contentsScaleX; | 333 float m_contentsScaleX; |
332 float m_contentsScaleY; | 334 float m_contentsScaleY; |
333 gfx::Vector2d m_scrollOffset; | 335 gfx::Vector2d m_scrollOffset; |
334 bool m_scrollable; | 336 bool m_scrollable; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 // Group of properties that need to be computed based on the layer tree | 405 // Group of properties that need to be computed based on the layer tree |
404 // hierarchy before layers can be drawn. | 406 // hierarchy before layers can be drawn. |
405 DrawProperties<LayerImpl, RenderSurfaceImpl> m_drawProperties; | 407 DrawProperties<LayerImpl, RenderSurfaceImpl> m_drawProperties; |
406 | 408 |
407 DISALLOW_COPY_AND_ASSIGN(LayerImpl); | 409 DISALLOW_COPY_AND_ASSIGN(LayerImpl); |
408 }; | 410 }; |
409 | 411 |
410 } | 412 } |
411 | 413 |
412 #endif // CC_LAYER_IMPL_H_ | 414 #endif // CC_LAYER_IMPL_H_ |
OLD | NEW |