| 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 18 matching lines...) Expand all Loading... |
| 29 class LayerSorter; | 29 class LayerSorter; |
| 30 class LayerTreeHostImpl; | 30 class LayerTreeHostImpl; |
| 31 class QuadSink; | 31 class QuadSink; |
| 32 class Renderer; | 32 class Renderer; |
| 33 class ScrollbarAnimationController; | 33 class ScrollbarAnimationController; |
| 34 class ScrollbarLayerImpl; | 34 class ScrollbarLayerImpl; |
| 35 class Layer; | 35 class Layer; |
| 36 | 36 |
| 37 struct AppendQuadsData; | 37 struct AppendQuadsData; |
| 38 | 38 |
| 39 class CC_EXPORT LayerImpl : public LayerAnimationControllerClient { | 39 class CC_EXPORT LayerImpl { |
| 40 public: | 40 public: |
| 41 static scoped_ptr<LayerImpl> create(int id) | 41 static scoped_ptr<LayerImpl> create(int id) |
| 42 { | 42 { |
| 43 return make_scoped_ptr(new LayerImpl(id)); | 43 return make_scoped_ptr(new LayerImpl(id)); |
| 44 } | 44 } |
| 45 | 45 |
| 46 virtual ~LayerImpl(); | 46 virtual ~LayerImpl(); |
| 47 | 47 |
| 48 // LayerAnimationControllerClient implementation. | 48 int id() const; |
| 49 virtual int id() const OVERRIDE; | |
| 50 virtual void setOpacityFromAnimation(float) OVERRIDE; | |
| 51 virtual float opacity() const OVERRIDE; | |
| 52 virtual void setTransformFromAnimation(const gfx::Transform&) OVERRIDE; | |
| 53 virtual const gfx::Transform& transform() const OVERRIDE; | |
| 54 | 49 |
| 55 // Tree structure. | 50 // Tree structure. |
| 56 LayerImpl* parent() { return m_parent; } | 51 LayerImpl* parent() { return m_parent; } |
| 57 const LayerImpl* parent() const { return m_parent; } | 52 const LayerImpl* parent() const { return m_parent; } |
| 58 const ScopedPtrVector<LayerImpl>& children() const { return m_children; } | 53 const ScopedPtrVector<LayerImpl>& children() const { return m_children; } |
| 59 void addChild(scoped_ptr<LayerImpl>); | 54 void addChild(scoped_ptr<LayerImpl>); |
| 60 void removeFromParent(); | 55 void removeFromParent(); |
| 61 void removeAllChildren(); | 56 void removeAllChildren(); |
| 62 | 57 |
| 63 void setMaskLayer(scoped_ptr<LayerImpl>); | 58 void setMaskLayer(scoped_ptr<LayerImpl>); |
| 64 LayerImpl* maskLayer() { return m_maskLayer.get(); } | 59 LayerImpl* maskLayer() { return m_maskLayer.get(); } |
| 65 const LayerImpl* maskLayer() const { return m_maskLayer.get(); } | 60 const LayerImpl* maskLayer() const { return m_maskLayer.get(); } |
| 66 | 61 |
| 67 void setReplicaLayer(scoped_ptr<LayerImpl>); | 62 void setReplicaLayer(scoped_ptr<LayerImpl>); |
| 68 LayerImpl* replicaLayer() { return m_replicaLayer.get(); } | 63 LayerImpl* replicaLayer() { return m_replicaLayer.get(); } |
| 69 const LayerImpl* replicaLayer() const { return m_replicaLayer.get(); } | 64 const LayerImpl* replicaLayer() const { return m_replicaLayer.get(); } |
| 70 | 65 |
| 71 bool hasMask() const { return m_maskLayer; } | 66 bool hasMask() const { return m_maskLayer; } |
| 72 bool hasReplica() const { return m_replicaLayer; } | 67 bool hasReplica() const { return m_replicaLayer; } |
| 73 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); } |
| 74 | 69 |
| 75 LayerTreeHostImpl* layerTreeHostImpl() const { return m_layerTreeHostImpl; } | 70 LayerTreeHostImpl* layerTreeHostImpl() const { return m_layerTreeHostImpl; } |
| 76 void setLayerTreeHostImpl(LayerTreeHostImpl* hostImpl) { m_layerTreeHostImpl
= hostImpl; } | 71 void setLayerTreeHostImpl(LayerTreeHostImpl* hostImpl); |
| 77 | 72 |
| 78 scoped_ptr<SharedQuadState> createSharedQuadState() const; | 73 scoped_ptr<SharedQuadState> createSharedQuadState() const; |
| 79 // willDraw must be called before appendQuads. If willDraw is called, | 74 // willDraw must be called before appendQuads. If willDraw is called, |
| 80 // didDraw is guaranteed to be called before another willDraw or before | 75 // didDraw is guaranteed to be called before another willDraw or before |
| 81 // the layer is destroyed. To enforce this, any class that overrides | 76 // the layer is destroyed. To enforce this, any class that overrides |
| 82 // willDraw/didDraw must call the base class version. | 77 // willDraw/didDraw must call the base class version. |
| 83 virtual void willDraw(ResourceProvider*); | 78 virtual void willDraw(ResourceProvider*); |
| 84 virtual void appendQuads(QuadSink&, AppendQuadsData&) { } | 79 virtual void appendQuads(QuadSink&, AppendQuadsData&) { } |
| 85 virtual void didDraw(ResourceProvider*); | 80 virtual void didDraw(ResourceProvider*); |
| 86 | 81 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 void setFilter(SkImageFilter*); | 113 void setFilter(SkImageFilter*); |
| 119 SkImageFilter* filter() const { return m_filter; } | 114 SkImageFilter* filter() const { return m_filter; } |
| 120 | 115 |
| 121 void setMasksToBounds(bool); | 116 void setMasksToBounds(bool); |
| 122 bool masksToBounds() const { return m_masksToBounds; } | 117 bool masksToBounds() const { return m_masksToBounds; } |
| 123 | 118 |
| 124 void setContentsOpaque(bool); | 119 void setContentsOpaque(bool); |
| 125 bool contentsOpaque() const { return m_contentsOpaque; } | 120 bool contentsOpaque() const { return m_contentsOpaque; } |
| 126 | 121 |
| 127 void setOpacity(float); | 122 void setOpacity(float); |
| 123 float opacity() const; |
| 128 bool opacityIsAnimating() const; | 124 bool opacityIsAnimating() const; |
| 129 | 125 |
| 130 void setPosition(const gfx::PointF&); | 126 void setPosition(const gfx::PointF&); |
| 131 const gfx::PointF& position() const { return m_position; } | 127 const gfx::PointF& position() const { return m_position; } |
| 132 | 128 |
| 133 void setIsContainerForFixedPositionLayers(bool isContainerForFixedPositionLa
yers) { m_isContainerForFixedPositionLayers = isContainerForFixedPositionLayers;
} | 129 void setIsContainerForFixedPositionLayers(bool isContainerForFixedPositionLa
yers) { m_isContainerForFixedPositionLayers = isContainerForFixedPositionLayers;
} |
| 134 bool isContainerForFixedPositionLayers() const { return m_isContainerForFixe
dPositionLayers; } | 130 bool isContainerForFixedPositionLayers() const { return m_isContainerForFixe
dPositionLayers; } |
| 135 | 131 |
| 136 void setFixedToContainerLayer(bool fixedToContainerLayer = true) { m_fixedTo
ContainerLayer = fixedToContainerLayer;} | 132 void setFixedToContainerLayer(bool fixedToContainerLayer = true) { m_fixedTo
ContainerLayer = fixedToContainerLayer;} |
| 137 bool fixedToContainerLayer() const { return m_fixedToContainerLayer; } | 133 bool fixedToContainerLayer() const { return m_fixedToContainerLayer; } |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 218 |
| 223 InputHandlerClient::ScrollStatus tryScroll(const gfx::PointF& screenSpacePoi
nt, InputHandlerClient::ScrollInputType) const; | 219 InputHandlerClient::ScrollStatus tryScroll(const gfx::PointF& screenSpacePoi
nt, InputHandlerClient::ScrollInputType) const; |
| 224 | 220 |
| 225 const gfx::Rect& visibleContentRect() const { return m_visibleContentRect; } | 221 const gfx::Rect& visibleContentRect() const { return m_visibleContentRect; } |
| 226 void setVisibleContentRect(const gfx::Rect& visibleContentRect) { m_visibleC
ontentRect = visibleContentRect; } | 222 void setVisibleContentRect(const gfx::Rect& visibleContentRect) { m_visibleC
ontentRect = visibleContentRect; } |
| 227 | 223 |
| 228 bool doubleSided() const { return m_doubleSided; } | 224 bool doubleSided() const { return m_doubleSided; } |
| 229 void setDoubleSided(bool); | 225 void setDoubleSided(bool); |
| 230 | 226 |
| 231 void setTransform(const gfx::Transform&); | 227 void setTransform(const gfx::Transform&); |
| 228 const gfx::Transform& transform() const; |
| 232 bool transformIsAnimating() const; | 229 bool transformIsAnimating() const; |
| 233 | 230 |
| 234 const gfx::Transform& drawTransform() const { return m_drawTransform; } | 231 const gfx::Transform& drawTransform() const { return m_drawTransform; } |
| 235 void setDrawTransform(const gfx::Transform& matrix) { m_drawTransform = matr
ix; } | 232 void setDrawTransform(const gfx::Transform& matrix) { m_drawTransform = matr
ix; } |
| 236 const gfx::Transform& screenSpaceTransform() const { return m_screenSpaceTra
nsform; } | 233 const gfx::Transform& screenSpaceTransform() const { return m_screenSpaceTra
nsform; } |
| 237 void setScreenSpaceTransform(const gfx::Transform& matrix) { m_screenSpaceTr
ansform = matrix; } | 234 void setScreenSpaceTransform(const gfx::Transform& matrix) { m_screenSpaceTr
ansform = matrix; } |
| 238 | 235 |
| 239 bool drawTransformIsAnimating() const { return m_drawTransformIsAnimating; } | 236 bool drawTransformIsAnimating() const { return m_drawTransformIsAnimating; } |
| 240 void setDrawTransformIsAnimating(bool animating) { m_drawTransformIsAnimatin
g = animating; } | 237 void setDrawTransformIsAnimating(bool animating) { m_drawTransformIsAnimatin
g = animating; } |
| 241 bool screenSpaceTransformIsAnimating() const { return m_screenSpaceTransform
IsAnimating; } | 238 bool screenSpaceTransformIsAnimating() const { return m_screenSpaceTransform
IsAnimating; } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 // affect the pixels on its target surface, but would require redrawing | 345 // affect the pixels on its target surface, but would require redrawing |
| 349 // but would require redrawing the targetSurface onto its ancestor targetSur
face. | 346 // but would require redrawing the targetSurface onto its ancestor targetSur
face. |
| 350 // For layers that do not own a surface this flag acts as m_layerPropertyCha
nged. | 347 // For layers that do not own a surface this flag acts as m_layerPropertyCha
nged. |
| 351 bool m_layerSurfacePropertyChanged; | 348 bool m_layerSurfacePropertyChanged; |
| 352 | 349 |
| 353 // Uses layer's content space. | 350 // Uses layer's content space. |
| 354 gfx::Rect m_visibleContentRect; | 351 gfx::Rect m_visibleContentRect; |
| 355 bool m_masksToBounds; | 352 bool m_masksToBounds; |
| 356 bool m_contentsOpaque; | 353 bool m_contentsOpaque; |
| 357 float m_opacity; | 354 float m_opacity; |
| 355 base::TimeTicks m_opacityLastUpdateTime; |
| 358 gfx::PointF m_position; | 356 gfx::PointF m_position; |
| 359 bool m_preserves3D; | 357 bool m_preserves3D; |
| 360 bool m_useParentBackfaceVisibility; | 358 bool m_useParentBackfaceVisibility; |
| 361 bool m_drawCheckerboardForMissingTiles; | 359 bool m_drawCheckerboardForMissingTiles; |
| 362 gfx::Transform m_sublayerTransform; | 360 gfx::Transform m_sublayerTransform; |
| 363 gfx::Transform m_transform; | 361 gfx::Transform m_transform; |
| 362 base::TimeTicks m_transformLastUpdateTime; |
| 364 bool m_useLCDText; | 363 bool m_useLCDText; |
| 365 | 364 |
| 366 bool m_drawsContent; | 365 bool m_drawsContent; |
| 367 bool m_forceRenderSurface; | 366 bool m_forceRenderSurface; |
| 368 | 367 |
| 369 // Set for the layer that other layers are fixed to. | 368 // Set for the layer that other layers are fixed to. |
| 370 bool m_isContainerForFixedPositionLayers; | 369 bool m_isContainerForFixedPositionLayers; |
| 371 // This is true if the layer should be fixed to the closest ancestor contain
er. | 370 // This is true if the layer should be fixed to the closest ancestor contain
er. |
| 372 bool m_fixedToContainerLayer; | 371 bool m_fixedToContainerLayer; |
| 373 | 372 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 | 412 |
| 414 // True if the layer is clipped by m_clipRect. | 413 // True if the layer is clipped by m_clipRect. |
| 415 bool m_isClipped; | 414 bool m_isClipped; |
| 416 | 415 |
| 417 // Rect indicating what was repainted/updated during update. | 416 // Rect indicating what was repainted/updated during update. |
| 418 // Note that plugin layers bypass this and leave it empty. | 417 // Note that plugin layers bypass this and leave it empty. |
| 419 // Uses layer's content space. | 418 // Uses layer's content space. |
| 420 gfx::RectF m_updateRect; | 419 gfx::RectF m_updateRect; |
| 421 | 420 |
| 422 // Manages animations for this layer. | 421 // Manages animations for this layer. |
| 423 scoped_ptr<LayerAnimationController> m_layerAnimationController; | 422 scoped_refptr<LayerAnimationController> m_layerAnimationController; |
| 424 | 423 |
| 425 // Manages scrollbars for this layer | 424 // Manages scrollbars for this layer |
| 426 scoped_ptr<ScrollbarAnimationController> m_scrollbarAnimationController; | 425 scoped_ptr<ScrollbarAnimationController> m_scrollbarAnimationController; |
| 427 | 426 |
| 428 DISALLOW_COPY_AND_ASSIGN(LayerImpl); | 427 DISALLOW_COPY_AND_ASSIGN(LayerImpl); |
| 429 }; | 428 }; |
| 430 | 429 |
| 431 void sortLayers(std::vector<LayerImpl*>::iterator first, std::vector<LayerImpl*>
::iterator end, LayerSorter*); | 430 void sortLayers(std::vector<LayerImpl*>::iterator first, std::vector<LayerImpl*>
::iterator end, LayerSorter*); |
| 432 | 431 |
| 433 } | 432 } |
| 434 | 433 |
| 435 #endif // CC_LAYER_IMPL_H_ | 434 #endif // CC_LAYER_IMPL_H_ |
| OLD | NEW |