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