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 <public/WebFilterOperations.h> | 8 #include <public/WebFilterOperations.h> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 | 77 |
78 void setAnchorPointZ(float); | 78 void setAnchorPointZ(float); |
79 float anchorPointZ() const { return m_anchorPointZ; } | 79 float anchorPointZ() const { return m_anchorPointZ; } |
80 | 80 |
81 virtual void setBackgroundColor(SkColor); | 81 virtual void setBackgroundColor(SkColor); |
82 SkColor backgroundColor() const { return m_backgroundColor; } | 82 SkColor backgroundColor() const { return m_backgroundColor; } |
83 | 83 |
84 // A layer's bounds are in logical, non-page-scaled pixels (however, the | 84 // A layer's bounds are in logical, non-page-scaled pixels (however, the |
85 // root layer's bounds are in physical pixels). | 85 // root layer's bounds are in physical pixels). |
86 void setBounds(const gfx::Size&); | 86 void setBounds(const gfx::Size&); |
87 // TODO(enne): remove this function: http://crbug.com/166023 | |
88 virtual void didUpdateBounds(); | |
87 const gfx::Size& bounds() const { return m_bounds; } | 89 const gfx::Size& bounds() const { return m_bounds; } |
88 virtual gfx::Size contentBounds() const; | |
89 | 90 |
90 void setMasksToBounds(bool); | 91 void setMasksToBounds(bool); |
91 bool masksToBounds() const { return m_masksToBounds; } | 92 bool masksToBounds() const { return m_masksToBounds; } |
92 | 93 |
93 void setMaskLayer(Layer*); | 94 void setMaskLayer(Layer*); |
94 Layer* maskLayer() { return m_maskLayer.get(); } | 95 Layer* maskLayer() { return m_maskLayer.get(); } |
95 const Layer* maskLayer() const { return m_maskLayer.get(); } | 96 const Layer* maskLayer() const { return m_maskLayer.get(); } |
96 | 97 |
97 virtual void setNeedsDisplayRect(const gfx::RectF& dirtyRect); | 98 virtual void setNeedsDisplayRect(const gfx::RectF& dirtyRect); |
98 void setNeedsDisplay() { setNeedsDisplayRect(gfx::RectF(gfx::PointF(), bound s())); } | 99 void setNeedsDisplay() { setNeedsDisplayRect(gfx::RectF(gfx::PointF(), bound s())); } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
219 void setDebugName(const std::string&); | 220 void setDebugName(const std::string&); |
220 | 221 |
221 virtual void pushPropertiesTo(LayerImpl*); | 222 virtual void pushPropertiesTo(LayerImpl*); |
222 | 223 |
223 void clearRenderSurface() { m_drawProperties.render_surface.reset(); } | 224 void clearRenderSurface() { m_drawProperties.render_surface.reset(); } |
224 void createRenderSurface(); | 225 void createRenderSurface(); |
225 | 226 |
226 // The contentsScale converts from logical, non-page-scaled pixels to target pixels. | 227 // The contentsScale converts from logical, non-page-scaled pixels to target pixels. |
227 // The contentsScale is 1 for the root layer as it is already in physical pi xels. | 228 // The contentsScale is 1 for the root layer as it is already in physical pi xels. |
228 // By default contentsScale is forced to be 1 except for subclasses of Conte ntsScalingLayer. | 229 // By default contentsScale is forced to be 1 except for subclasses of Conte ntsScalingLayer. |
229 virtual float contentsScaleX() const; | 230 float contentsScaleX() const { return m_drawProperties.contents_scale_x; } |
230 virtual float contentsScaleY() const; | 231 float contentsScaleY() const { return m_drawProperties.contents_scale_y; } |
231 virtual void setContentsScale(float contentsScale) { } | 232 gfx::Size contentBounds() const { return m_drawProperties.content_bounds; } |
233 virtual void updateContentsScale(float ideal_contents_scale); | |
232 | 234 |
233 // The scale at which contents should be rastered, to match the scale at | 235 // The scale at which contents should be rastered, to match the scale at |
234 // which they will drawn to the screen. This scale is a component of the | 236 // which they will drawn to the screen. This scale is a component of the |
235 // contentsScale() but does not include page/device scale factors. | 237 // contentsScale() but does not include page/device scale factors. |
236 float rasterScale() const { return m_rasterScale; } | 238 float rasterScale() const { return m_rasterScale; } |
237 void setRasterScale(float scale); | 239 void setRasterScale(float scale); |
238 | 240 |
239 // When true, the rasterScale() will be set by the compositor. If false, it | 241 // When true, the rasterScale() will be set by the compositor. If false, it |
240 // will use whatever value is given to it by the embedder. | 242 // will use whatever value is given to it by the embedder. |
241 bool automaticallyComputeRasterScale() { return m_automaticallyComputeRaster Scale; } | 243 bool automaticallyComputeRasterScale() { return m_automaticallyComputeRaster Scale; } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
303 // is not available and the update rect will remain empty. | 305 // is not available and the update rect will remain empty. |
304 // Note this rect is in layer space (not content space). | 306 // Note this rect is in layer space (not content space). |
305 gfx::RectF m_updateRect; | 307 gfx::RectF m_updateRect; |
306 | 308 |
307 scoped_refptr<Layer> m_maskLayer; | 309 scoped_refptr<Layer> m_maskLayer; |
308 | 310 |
309 // Constructs a LayerImpl of the correct runtime type for this Layer type. | 311 // Constructs a LayerImpl of the correct runtime type for this Layer type. |
310 virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl); | 312 virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl); |
311 int m_layerId; | 313 int m_layerId; |
312 | 314 |
315 DrawProperties<Layer, RenderSurface> m_drawProperties; | |
danakj
2012/12/14 20:37:23
This can stay private I think.
If the subclass do
| |
316 | |
313 private: | 317 private: |
314 friend class base::RefCounted<Layer>; | 318 friend class base::RefCounted<Layer>; |
315 | 319 |
316 void setParent(Layer*); | 320 void setParent(Layer*); |
317 bool hasAncestor(Layer*) const; | 321 bool hasAncestor(Layer*) const; |
318 bool descendantIsFixedToContainerLayer() const; | 322 bool descendantIsFixedToContainerLayer() const; |
319 | 323 |
320 size_t numChildren() const { return m_children.size(); } | 324 size_t numChildren() const { return m_children.size(); } |
321 | 325 |
322 // Returns the index of the child or -1 if not found. | 326 // Returns the index of the child or -1 if not found. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
375 | 379 |
376 // Transient properties. | 380 // Transient properties. |
377 float m_rasterScale; | 381 float m_rasterScale; |
378 bool m_automaticallyComputeRasterScale; | 382 bool m_automaticallyComputeRasterScale; |
379 bool m_boundsContainPageScale; | 383 bool m_boundsContainPageScale; |
380 | 384 |
381 gfx::Transform m_implTransform; | 385 gfx::Transform m_implTransform; |
382 | 386 |
383 WebKit::WebAnimationDelegate* m_layerAnimationDelegate; | 387 WebKit::WebAnimationDelegate* m_layerAnimationDelegate; |
384 WebKit::WebLayerScrollClient* m_layerScrollClient; | 388 WebKit::WebLayerScrollClient* m_layerScrollClient; |
385 | |
386 DrawProperties<Layer, RenderSurface> m_drawProperties; | |
387 }; | 389 }; |
388 | 390 |
389 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped _refptr<Layer> >::iterator, void*); | 391 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped _refptr<Layer> >::iterator, void*); |
390 | 392 |
391 } // namespace cc | 393 } // namespace cc |
392 | 394 |
393 #endif // CC_LAYER_H_ | 395 #endif // CC_LAYER_H_ |
OLD | NEW |