OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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_H_ | 5 #ifndef CC_LAYER_H_ |
6 #define CC_LAYER_H_ | 6 #define CC_LAYER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 Layer* parent() { return m_parent; } | 60 Layer* parent() { return m_parent; } |
61 const Layer* parent() const { return m_parent; } | 61 const Layer* parent() const { return m_parent; } |
62 void addChild(scoped_refptr<Layer>); | 62 void addChild(scoped_refptr<Layer>); |
63 void insertChild(scoped_refptr<Layer>, size_t index); | 63 void insertChild(scoped_refptr<Layer>, size_t index); |
64 void replaceChild(Layer* reference, scoped_refptr<Layer> newLayer); | 64 void replaceChild(Layer* reference, scoped_refptr<Layer> newLayer); |
65 void removeFromParent(); | 65 void removeFromParent(); |
66 void removeAllChildren(); | 66 void removeAllChildren(); |
67 void setChildren(const LayerList&); | 67 void setChildren(const LayerList&); |
68 | 68 |
69 const LayerList& children() const { return m_children; } | 69 const LayerList& children() const { return m_children; } |
| 70 Layer* childAt(size_t index); |
70 | 71 |
71 void setAnchorPoint(const gfx::PointF&); | 72 void setAnchorPoint(const gfx::PointF&); |
72 gfx::PointF anchorPoint() const { return m_anchorPoint; } | 73 gfx::PointF anchorPoint() const { return m_anchorPoint; } |
73 | 74 |
74 void setAnchorPointZ(float); | 75 void setAnchorPointZ(float); |
75 float anchorPointZ() const { return m_anchorPointZ; } | 76 float anchorPointZ() const { return m_anchorPointZ; } |
76 | 77 |
77 virtual void setBackgroundColor(SkColor); | 78 virtual void setBackgroundColor(SkColor); |
78 SkColor backgroundColor() const { return m_backgroundColor; } | 79 SkColor backgroundColor() const { return m_backgroundColor; } |
79 | 80 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 285 |
285 // In impl-side painting, this returns true if this layer type is not | 286 // In impl-side painting, this returns true if this layer type is not |
286 // compatible with the main thread running freely, such as a double-buffered | 287 // compatible with the main thread running freely, such as a double-buffered |
287 // canvas that doesn't want to be triple-buffered across all three trees. | 288 // canvas that doesn't want to be triple-buffered across all three trees. |
288 virtual bool blocksPendingCommit() const; | 289 virtual bool blocksPendingCommit() const; |
289 // Returns true if anything in this tree blocksPendingCommit. | 290 // Returns true if anything in this tree blocksPendingCommit. |
290 bool blocksPendingCommitRecursive() const; | 291 bool blocksPendingCommitRecursive() const; |
291 | 292 |
292 virtual bool canClipSelf() const; | 293 virtual bool canClipSelf() const; |
293 | 294 |
| 295 // Constructs a LayerImpl of the correct runtime type for this Layer type. |
| 296 virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl); |
| 297 |
294 protected: | 298 protected: |
295 friend class LayerImpl; | 299 friend class LayerImpl; |
296 friend class TreeSynchronizer; | 300 friend class TreeSynchronizer; |
297 virtual ~Layer(); | 301 virtual ~Layer(); |
298 | 302 |
299 Layer(); | 303 Layer(); |
300 | 304 |
301 void setNeedsCommit(); | 305 void setNeedsCommit(); |
302 void setNeedsFullTreeSync(); | 306 void setNeedsFullTreeSync(); |
303 | 307 |
304 // This flag is set when layer need repainting/updating. | 308 // This flag is set when layer need repainting/updating. |
305 bool m_needsDisplay; | 309 bool m_needsDisplay; |
306 | 310 |
307 // Tracks whether this layer may have changed stacking order with its siblin
gs. | 311 // Tracks whether this layer may have changed stacking order with its siblin
gs. |
308 bool m_stackingOrderChanged; | 312 bool m_stackingOrderChanged; |
309 | 313 |
310 // The update rect is the region of the compositor resource that was actuall
y updated by the compositor. | 314 // The update rect is the region of the compositor resource that was actuall
y updated by the compositor. |
311 // For layers that may do updating outside the compositor's control (i.e. pl
ugin layers), this information | 315 // For layers that may do updating outside the compositor's control (i.e. pl
ugin layers), this information |
312 // is not available and the update rect will remain empty. | 316 // is not available and the update rect will remain empty. |
313 // Note this rect is in layer space (not content space). | 317 // Note this rect is in layer space (not content space). |
314 gfx::RectF m_updateRect; | 318 gfx::RectF m_updateRect; |
315 | 319 |
316 scoped_refptr<Layer> m_maskLayer; | 320 scoped_refptr<Layer> m_maskLayer; |
317 | 321 |
318 // Constructs a LayerImpl of the correct runtime type for this Layer type. | |
319 virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl); | |
320 int m_layerId; | 322 int m_layerId; |
321 | 323 |
322 // When true, the layer is about to perform an update. Any commit requests | 324 // When true, the layer is about to perform an update. Any commit requests |
323 // will be handled implcitly after the update completes. | 325 // will be handled implcitly after the update completes. |
324 bool m_ignoreSetNeedsCommit; | 326 bool m_ignoreSetNeedsCommit; |
325 | 327 |
326 private: | 328 private: |
327 friend class base::RefCounted<Layer>; | 329 friend class base::RefCounted<Layer>; |
328 | 330 |
329 void setParent(Layer*); | 331 void setParent(Layer*); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 WebKit::WebLayerScrollClient* m_layerScrollClient; | 404 WebKit::WebLayerScrollClient* m_layerScrollClient; |
403 | 405 |
404 DrawProperties<Layer, RenderSurface> m_drawProperties; | 406 DrawProperties<Layer, RenderSurface> m_drawProperties; |
405 }; | 407 }; |
406 | 408 |
407 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*); | 409 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*); |
408 | 410 |
409 } // namespace cc | 411 } // namespace cc |
410 | 412 |
411 #endif // CC_LAYER_H_ | 413 #endif // CC_LAYER_H_ |
OLD | NEW |