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 24 matching lines...) Expand all Loading... |
35 | 35 |
36 class LayerTreeHostImpl; | 36 class LayerTreeHostImpl; |
37 class QuadSink; | 37 class QuadSink; |
38 class Renderer; | 38 class Renderer; |
39 class ScrollbarAnimationController; | 39 class ScrollbarAnimationController; |
40 class ScrollbarLayerImpl; | 40 class ScrollbarLayerImpl; |
41 class Layer; | 41 class Layer; |
42 | 42 |
43 struct AppendQuadsData; | 43 struct AppendQuadsData; |
44 | 44 |
45 class CC_EXPORT LayerImpl { | 45 class CC_EXPORT LayerImpl : public LayerAnimationControllerClient { |
46 public: | 46 public: |
47 typedef ScopedPtrVector<LayerImpl> LayerList; | 47 typedef ScopedPtrVector<LayerImpl> LayerList; |
48 | 48 |
49 static scoped_ptr<LayerImpl> create(LayerTreeHostImpl* hostImpl, int id) | 49 static scoped_ptr<LayerImpl> create(LayerTreeHostImpl* hostImpl, int id) |
50 { | 50 { |
51 return make_scoped_ptr(new LayerImpl(hostImpl, id)); | 51 return make_scoped_ptr(new LayerImpl(hostImpl, id)); |
52 } | 52 } |
53 | 53 |
54 virtual ~LayerImpl(); | 54 virtual ~LayerImpl(); |
55 | 55 |
56 int id() const; | 56 // LayerAnimationControllerClient implementation. |
| 57 virtual int id() const OVERRIDE; |
| 58 virtual void setOpacityFromAnimation(float) OVERRIDE; |
| 59 virtual float opacity() const OVERRIDE; |
| 60 virtual void setTransformFromAnimation(const gfx::Transform&) OVERRIDE; |
| 61 virtual const gfx::Transform& transform() const OVERRIDE; |
57 | 62 |
58 // Tree structure. | 63 // Tree structure. |
59 LayerImpl* parent() { return m_parent; } | 64 LayerImpl* parent() { return m_parent; } |
60 const LayerImpl* parent() const { return m_parent; } | 65 const LayerImpl* parent() const { return m_parent; } |
61 const LayerList& children() const { return m_children; } | 66 const LayerList& children() const { return m_children; } |
62 void addChild(scoped_ptr<LayerImpl>); | 67 void addChild(scoped_ptr<LayerImpl>); |
63 void removeFromParent(); | 68 void removeFromParent(); |
64 void removeAllChildren(); | 69 void removeAllChildren(); |
65 | 70 |
66 void setMaskLayer(scoped_ptr<LayerImpl>); | 71 void setMaskLayer(scoped_ptr<LayerImpl>); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 void setFilter(const skia::RefPtr<SkImageFilter>&); | 127 void setFilter(const skia::RefPtr<SkImageFilter>&); |
123 skia::RefPtr<SkImageFilter> filter() const { return m_filter; } | 128 skia::RefPtr<SkImageFilter> filter() const { return m_filter; } |
124 | 129 |
125 void setMasksToBounds(bool); | 130 void setMasksToBounds(bool); |
126 bool masksToBounds() const { return m_masksToBounds; } | 131 bool masksToBounds() const { return m_masksToBounds; } |
127 | 132 |
128 void setContentsOpaque(bool); | 133 void setContentsOpaque(bool); |
129 bool contentsOpaque() const { return m_contentsOpaque; } | 134 bool contentsOpaque() const { return m_contentsOpaque; } |
130 | 135 |
131 void setOpacity(float); | 136 void setOpacity(float); |
132 float opacity() const; | |
133 bool opacityIsAnimating() const; | 137 bool opacityIsAnimating() const; |
134 | 138 |
135 void setPosition(const gfx::PointF&); | 139 void setPosition(const gfx::PointF&); |
136 const gfx::PointF& position() const { return m_position; } | 140 const gfx::PointF& position() const { return m_position; } |
137 | 141 |
138 void setIsContainerForFixedPositionLayers(bool isContainerForFixedPositionLa
yers) { m_isContainerForFixedPositionLayers = isContainerForFixedPositionLayers;
} | 142 void setIsContainerForFixedPositionLayers(bool isContainerForFixedPositionLa
yers) { m_isContainerForFixedPositionLayers = isContainerForFixedPositionLayers;
} |
139 bool isContainerForFixedPositionLayers() const { return m_isContainerForFixe
dPositionLayers; } | 143 bool isContainerForFixedPositionLayers() const { return m_isContainerForFixe
dPositionLayers; } |
140 | 144 |
141 void setFixedToContainerLayer(bool fixedToContainerLayer = true) { m_fixedTo
ContainerLayer = fixedToContainerLayer;} | 145 void setFixedToContainerLayer(bool fixedToContainerLayer = true) { m_fixedTo
ContainerLayer = fixedToContainerLayer;} |
142 bool fixedToContainerLayer() const { return m_fixedToContainerLayer; } | 146 bool fixedToContainerLayer() const { return m_fixedToContainerLayer; } |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 235 |
232 void setDrawCheckerboardForMissingTiles(bool checkerboard) { m_drawCheckerbo
ardForMissingTiles = checkerboard; } | 236 void setDrawCheckerboardForMissingTiles(bool checkerboard) { m_drawCheckerbo
ardForMissingTiles = checkerboard; } |
233 bool drawCheckerboardForMissingTiles() const; | 237 bool drawCheckerboardForMissingTiles() const; |
234 | 238 |
235 InputHandlerClient::ScrollStatus tryScroll(const gfx::PointF& screenSpacePoi
nt, InputHandlerClient::ScrollInputType) const; | 239 InputHandlerClient::ScrollStatus tryScroll(const gfx::PointF& screenSpacePoi
nt, InputHandlerClient::ScrollInputType) const; |
236 | 240 |
237 bool doubleSided() const { return m_doubleSided; } | 241 bool doubleSided() const { return m_doubleSided; } |
238 void setDoubleSided(bool); | 242 void setDoubleSided(bool); |
239 | 243 |
240 void setTransform(const gfx::Transform&); | 244 void setTransform(const gfx::Transform&); |
241 const gfx::Transform& transform() const; | |
242 bool transformIsAnimating() const; | 245 bool transformIsAnimating() const; |
243 | 246 |
244 const gfx::RectF& updateRect() const { return m_updateRect; } | 247 const gfx::RectF& updateRect() const { return m_updateRect; } |
245 void setUpdateRect(const gfx::RectF& updateRect) { m_updateRect = updateRect
; } | 248 void setUpdateRect(const gfx::RectF& updateRect) { m_updateRect = updateRect
; } |
246 | 249 |
247 std::string layerTreeAsText() const; | 250 std::string layerTreeAsText() const; |
248 virtual base::DictionaryValue* layerTreeAsJson() const; | 251 virtual base::DictionaryValue* layerTreeAsJson() const; |
249 | 252 |
250 void setStackingOrderChanged(bool); | 253 void setStackingOrderChanged(bool); |
251 | 254 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 bool m_layerPropertyChanged; | 340 bool m_layerPropertyChanged; |
338 | 341 |
339 // Indicates that a property has changed on this layer that would not | 342 // Indicates that a property has changed on this layer that would not |
340 // affect the pixels on its target surface, but would require redrawing | 343 // affect the pixels on its target surface, but would require redrawing |
341 // but would require redrawing the targetSurface onto its ancestor targetSur
face. | 344 // but would require redrawing the targetSurface onto its ancestor targetSur
face. |
342 // For layers that do not own a surface this flag acts as m_layerPropertyCha
nged. | 345 // For layers that do not own a surface this flag acts as m_layerPropertyCha
nged. |
343 bool m_layerSurfacePropertyChanged; | 346 bool m_layerSurfacePropertyChanged; |
344 | 347 |
345 bool m_masksToBounds; | 348 bool m_masksToBounds; |
346 bool m_contentsOpaque; | 349 bool m_contentsOpaque; |
| 350 float m_opacity; |
347 gfx::PointF m_position; | 351 gfx::PointF m_position; |
348 bool m_preserves3D; | 352 bool m_preserves3D; |
349 bool m_useParentBackfaceVisibility; | 353 bool m_useParentBackfaceVisibility; |
350 bool m_drawCheckerboardForMissingTiles; | 354 bool m_drawCheckerboardForMissingTiles; |
351 gfx::Transform m_sublayerTransform; | 355 gfx::Transform m_sublayerTransform; |
| 356 gfx::Transform m_transform; |
352 bool m_useLCDText; | 357 bool m_useLCDText; |
353 | 358 |
354 bool m_drawsContent; | 359 bool m_drawsContent; |
355 bool m_forceRenderSurface; | 360 bool m_forceRenderSurface; |
356 | 361 |
357 // Set for the layer that other layers are fixed to. | 362 // Set for the layer that other layers are fixed to. |
358 bool m_isContainerForFixedPositionLayers; | 363 bool m_isContainerForFixedPositionLayers; |
359 // This is true if the layer should be fixed to the closest ancestor contain
er. | 364 // This is true if the layer should be fixed to the closest ancestor contain
er. |
360 bool m_fixedToContainerLayer; | 365 bool m_fixedToContainerLayer; |
361 | 366 |
(...skipping 16 matching lines...) Expand all Loading... |
378 #ifndef NDEBUG | 383 #ifndef NDEBUG |
379 bool m_betweenWillDrawAndDidDraw; | 384 bool m_betweenWillDrawAndDidDraw; |
380 #endif | 385 #endif |
381 | 386 |
382 // Rect indicating what was repainted/updated during update. | 387 // Rect indicating what was repainted/updated during update. |
383 // Note that plugin layers bypass this and leave it empty. | 388 // Note that plugin layers bypass this and leave it empty. |
384 // Uses layer's content space. | 389 // Uses layer's content space. |
385 gfx::RectF m_updateRect; | 390 gfx::RectF m_updateRect; |
386 | 391 |
387 // Manages animations for this layer. | 392 // Manages animations for this layer. |
388 scoped_refptr<LayerAnimationController> m_layerAnimationController; | 393 scoped_ptr<LayerAnimationController> m_layerAnimationController; |
389 | 394 |
390 // Manages scrollbars for this layer | 395 // Manages scrollbars for this layer |
391 scoped_ptr<ScrollbarAnimationController> m_scrollbarAnimationController; | 396 scoped_ptr<ScrollbarAnimationController> m_scrollbarAnimationController; |
392 | 397 |
393 // Group of properties that need to be computed based on the layer tree | 398 // Group of properties that need to be computed based on the layer tree |
394 // hierarchy before layers can be drawn. | 399 // hierarchy before layers can be drawn. |
395 DrawProperties<LayerImpl, RenderSurfaceImpl> m_drawProperties; | 400 DrawProperties<LayerImpl, RenderSurfaceImpl> m_drawProperties; |
396 | 401 |
397 DISALLOW_COPY_AND_ASSIGN(LayerImpl); | 402 DISALLOW_COPY_AND_ASSIGN(LayerImpl); |
398 }; | 403 }; |
399 | 404 |
400 } | 405 } |
401 | 406 |
402 #endif // CC_LAYER_IMPL_H_ | 407 #endif // CC_LAYER_IMPL_H_ |
OLD | NEW |