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 CCLayerImpl_h | 5 #ifndef CCLayerImpl_h |
6 #define CCLayerImpl_h | 6 #define CCLayerImpl_h |
7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" |
8 #include "CCInputHandler.h" | 9 #include "CCInputHandler.h" |
9 #include "CCLayerAnimationController.h" | 10 #include "CCLayerAnimationController.h" |
10 #include "CCRenderPass.h" | 11 #include "CCRenderPass.h" |
11 #include "CCRenderSurface.h" | 12 #include "CCRenderSurface.h" |
12 #include "CCResourceProvider.h" | 13 #include "CCResourceProvider.h" |
13 #include "CCSharedQuadState.h" | 14 #include "CCSharedQuadState.h" |
14 #include "FloatRect.h" | 15 #include "FloatRect.h" |
15 #include "IntRect.h" | 16 #include "IntRect.h" |
16 #include "Region.h" | 17 #include "Region.h" |
17 #include "SkColor.h" | 18 #include "SkColor.h" |
18 #include "cc/own_ptr_vector.h" | 19 #include "cc/scoped_ptr_vector.h" |
19 #include <public/WebFilterOperations.h> | 20 #include <public/WebFilterOperations.h> |
20 #include <public/WebTransformationMatrix.h> | 21 #include <public/WebTransformationMatrix.h> |
21 #include <string> | 22 #include <string> |
22 #include <wtf/OwnPtr.h> | 23 #include <wtf/OwnPtr.h> |
23 #include <wtf/PassRefPtr.h> | |
24 #include <wtf/RefCounted.h> | |
25 | 24 |
26 namespace cc { | 25 namespace cc { |
27 | 26 |
28 class CCLayerSorter; | 27 class CCLayerSorter; |
29 class CCLayerTreeHostImpl; | 28 class CCLayerTreeHostImpl; |
30 class CCQuadSink; | 29 class CCQuadSink; |
31 class CCRenderer; | 30 class CCRenderer; |
32 class CCScrollbarAnimationController; | 31 class CCScrollbarAnimationController; |
33 class CCScrollbarLayerImpl; | 32 class CCScrollbarLayerImpl; |
34 class LayerChromium; | 33 class LayerChromium; |
35 | 34 |
36 struct CCAppendQuadsData; | 35 struct CCAppendQuadsData; |
37 | 36 |
38 class CCLayerImpl : public CCLayerAnimationControllerClient { | 37 class CCLayerImpl : public CCLayerAnimationControllerClient { |
39 public: | 38 public: |
40 static PassOwnPtr<CCLayerImpl> create(int id) | 39 static scoped_ptr<CCLayerImpl> create(int id) |
41 { | 40 { |
42 return adoptPtr(new CCLayerImpl(id)); | 41 return make_scoped_ptr(new CCLayerImpl(id)); |
43 } | 42 } |
44 | 43 |
45 virtual ~CCLayerImpl(); | 44 virtual ~CCLayerImpl(); |
46 | 45 |
47 // CCLayerAnimationControllerClient implementation. | 46 // CCLayerAnimationControllerClient implementation. |
48 virtual int id() const OVERRIDE; | 47 virtual int id() const OVERRIDE; |
49 virtual void setOpacityFromAnimation(float) OVERRIDE; | 48 virtual void setOpacityFromAnimation(float) OVERRIDE; |
50 virtual float opacity() const OVERRIDE; | 49 virtual float opacity() const OVERRIDE; |
51 virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix
&) OVERRIDE; | 50 virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix
&) OVERRIDE; |
52 virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE; | 51 virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE; |
53 | 52 |
54 // Tree structure. | 53 // Tree structure. |
55 CCLayerImpl* parent() const { return m_parent; } | 54 CCLayerImpl* parent() const { return m_parent; } |
56 const OwnPtrVector<CCLayerImpl>& children() const { return m_children; } | 55 const ScopedPtrVector<CCLayerImpl>& children() const { return m_children; } |
57 void addChild(PassOwnPtr<CCLayerImpl>); | 56 void addChild(scoped_ptr<CCLayerImpl>); |
58 void removeFromParent(); | 57 void removeFromParent(); |
59 void removeAllChildren(); | 58 void removeAllChildren(); |
60 | 59 |
61 void setMaskLayer(PassOwnPtr<CCLayerImpl>); | 60 void setMaskLayer(scoped_ptr<CCLayerImpl>); |
62 CCLayerImpl* maskLayer() const { return m_maskLayer.get(); } | 61 CCLayerImpl* maskLayer() const { return m_maskLayer.get(); } |
63 | 62 |
64 void setReplicaLayer(PassOwnPtr<CCLayerImpl>); | 63 void setReplicaLayer(scoped_ptr<CCLayerImpl>); |
65 CCLayerImpl* replicaLayer() const { return m_replicaLayer.get(); } | 64 CCLayerImpl* replicaLayer() const { return m_replicaLayer.get(); } |
66 | 65 |
67 bool hasMask() const { return m_maskLayer; } | 66 bool hasMask() const { return m_maskLayer; } |
68 bool hasReplica() const { return m_replicaLayer; } | 67 bool hasReplica() const { return m_replicaLayer; } |
69 bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_rep
licaLayer->m_maskLayer); } | 68 bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_rep
licaLayer->m_maskLayer); } |
70 | 69 |
71 CCLayerTreeHostImpl* layerTreeHostImpl() const { return m_layerTreeHostImpl;
} | 70 CCLayerTreeHostImpl* layerTreeHostImpl() const { return m_layerTreeHostImpl;
} |
72 void setLayerTreeHostImpl(CCLayerTreeHostImpl* hostImpl) { m_layerTreeHostIm
pl = hostImpl; } | 71 void setLayerTreeHostImpl(CCLayerTreeHostImpl* hostImpl) { m_layerTreeHostIm
pl = hostImpl; } |
73 | 72 |
74 scoped_ptr<CCSharedQuadState> createSharedQuadState() const; | 73 scoped_ptr<CCSharedQuadState> createSharedQuadState() const; |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 275 |
277 // Note carefully this does not affect the current layer. | 276 // Note carefully this does not affect the current layer. |
278 void noteLayerPropertyChangedForDescendants(); | 277 void noteLayerPropertyChangedForDescendants(); |
279 | 278 |
280 virtual const char* layerTypeAsString() const; | 279 virtual const char* layerTypeAsString() const; |
281 | 280 |
282 void dumpLayer(std::string*, int indent) const; | 281 void dumpLayer(std::string*, int indent) const; |
283 | 282 |
284 // Properties internal to CCLayerImpl | 283 // Properties internal to CCLayerImpl |
285 CCLayerImpl* m_parent; | 284 CCLayerImpl* m_parent; |
286 OwnPtrVector<CCLayerImpl> m_children; | 285 ScopedPtrVector<CCLayerImpl> m_children; |
287 // m_maskLayer can be temporarily stolen during tree sync, we need this ID t
o confirm newly assigned layer is still the previous one | 286 // m_maskLayer can be temporarily stolen during tree sync, we need this ID t
o confirm newly assigned layer is still the previous one |
288 int m_maskLayerId; | 287 int m_maskLayerId; |
289 OwnPtr<CCLayerImpl> m_maskLayer; | 288 scoped_ptr<CCLayerImpl> m_maskLayer; |
290 int m_replicaLayerId; // ditto | 289 int m_replicaLayerId; // ditto |
291 OwnPtr<CCLayerImpl> m_replicaLayer; | 290 scoped_ptr<CCLayerImpl> m_replicaLayer; |
292 int m_layerId; | 291 int m_layerId; |
293 CCLayerTreeHostImpl* m_layerTreeHostImpl; | 292 CCLayerTreeHostImpl* m_layerTreeHostImpl; |
294 | 293 |
295 // Properties synchronized from the associated LayerChromium. | 294 // Properties synchronized from the associated LayerChromium. |
296 FloatPoint m_anchorPoint; | 295 FloatPoint m_anchorPoint; |
297 float m_anchorPointZ; | 296 float m_anchorPointZ; |
298 IntSize m_bounds; | 297 IntSize m_bounds; |
299 IntSize m_contentBounds; | 298 IntSize m_contentBounds; |
300 IntPoint m_scrollPosition; | 299 IntPoint m_scrollPosition; |
301 bool m_scrollable; | 300 bool m_scrollable; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 | 389 |
391 // Manages scrollbars for this layer | 390 // Manages scrollbars for this layer |
392 OwnPtr<CCScrollbarAnimationController> m_scrollbarAnimationController; | 391 OwnPtr<CCScrollbarAnimationController> m_scrollbarAnimationController; |
393 }; | 392 }; |
394 | 393 |
395 void sortLayers(std::vector<CCLayerImpl*>::iterator first, std::vector<CCLayerIm
pl*>::iterator end, CCLayerSorter*); | 394 void sortLayers(std::vector<CCLayerImpl*>::iterator first, std::vector<CCLayerIm
pl*>::iterator end, CCLayerSorter*); |
396 | 395 |
397 } | 396 } |
398 | 397 |
399 #endif // CCLayerImpl_h | 398 #endif // CCLayerImpl_h |
OLD | NEW |