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