Chromium Code Reviews| Index: cc/layer.h |
| diff --git a/cc/layer.h b/cc/layer.h |
| index f8506500ca7a6f144c45d5b4dcc847d35f7cb569..fd0bcc825ec904ae9caae78df0c63b11e76daac6 100644 |
| --- a/cc/layer.h |
| +++ b/cc/layer.h |
| @@ -11,6 +11,7 @@ |
| #include "base/memory/ref_counted.h" |
| #include "cc/cc_export.h" |
| +#include "cc/draw_properties.h" |
| #include "cc/layer_animation_controller.h" |
| #include "cc/occlusion_tracker.h" |
| #include "cc/region.h" |
| @@ -128,8 +129,22 @@ public: |
| void setTransform(const gfx::Transform&); |
| bool transformIsAnimating() const; |
| - const gfx::Rect& visibleContentRect() const { return m_visibleContentRect; } |
| - void setVisibleContentRect(const gfx::Rect& visibleContentRect) { m_visibleContentRect = visibleContentRect; } |
| + DrawProperties<Layer>& drawProperties() { return m_drawProperties; } |
| + const DrawProperties<Layer>& drawProperties() const { return m_drawProperties; } |
| + |
| + // The following are shortcut accessors to get various information from m_drawProperties |
| + const gfx::Transform& drawTransform() const { return m_drawProperties.drawTransform; } |
| + const gfx::Transform& screenSpaceTransform() const { return m_drawProperties.screenSpaceTransform; } |
| + float drawOpacity() const { return m_drawProperties.drawOpacity; } |
| + bool drawOpacityIsAnimating() const { return m_drawProperties.drawOpacityIsAnimating; } |
| + bool drawTransformIsAnimating() const { return m_drawProperties.drawTransformIsAnimating; } |
| + bool screenSpaceTransformIsAnimating() const { return m_drawProperties.screenSpaceTransformIsAnimating; } |
| + bool isClipped() const { return m_drawProperties.isClipped; } |
| + const gfx::Rect& clipRect() const { return m_drawProperties.clipRect; } |
| + const gfx::Rect& drawableContentRect() const { return m_drawProperties.drawableContentRect; } |
| + const gfx::Rect& visibleContentRect() const { return m_drawProperties.visibleContentRect; } |
| + Layer* renderTarget() { DCHECK(!m_drawProperties.renderTarget || m_drawProperties.renderTarget->renderSurface()); return m_drawProperties.renderTarget; } |
| + const Layer* renderTarget() const { DCHECK(!m_drawProperties.renderTarget || m_drawProperties.renderTarget->renderSurface()); return m_drawProperties.renderTarget; } |
| void setScrollOffset(gfx::Vector2d); |
| gfx::Vector2d scrollOffset() const { return m_scrollOffset; } |
| @@ -208,40 +223,6 @@ public: |
| RenderSurface* renderSurface() const { return m_renderSurface.get(); } |
| void createRenderSurface(); |
| - float drawOpacity() const { return m_drawOpacity; } |
| - void setDrawOpacity(float opacity) { m_drawOpacity = opacity; } |
| - |
| - bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; } |
| - void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityIsAnimating = drawOpacityIsAnimating; } |
| - |
| - void setRenderTarget(Layer* target) { m_renderTarget = target; } |
| - Layer* renderTarget() { DCHECK(!m_renderTarget || m_renderTarget->renderSurface()); return m_renderTarget; } |
| - const Layer* renderTarget() const { DCHECK(!m_renderTarget || m_renderTarget->renderSurface()); return m_renderTarget; } |
| - |
| - bool drawTransformIsAnimating() const { return m_drawTransformIsAnimating; } |
| - void setDrawTransformIsAnimating(bool animating) { m_drawTransformIsAnimating = animating; } |
| - bool screenSpaceTransformIsAnimating() const { return m_screenSpaceTransformIsAnimating; } |
| - void setScreenSpaceTransformIsAnimating(bool animating) { m_screenSpaceTransformIsAnimating = animating; } |
| - |
| - // This moves from layer space, with origin in the center to target space with origin in the top left. |
| - // That is, it converts from logical, non-page-scaled, to target pixels (and if the target is the |
| - // root render surface, then this converts to physical pixels). |
| - const gfx::Transform& drawTransform() const { return m_drawTransform; } |
| - void setDrawTransform(const gfx::Transform& matrix) { m_drawTransform = matrix; } |
| - // This moves from content space, with origin the top left to screen space with origin in the top left. |
| - // It converts logical, non-page-scaled pixels to physical pixels. |
| - const gfx::Transform& screenSpaceTransform() const { return m_screenSpaceTransform; } |
| - void setScreenSpaceTransform(const gfx::Transform& matrix) { m_screenSpaceTransform = matrix; } |
| - |
| - bool isClipped() const { return m_isClipped; } |
| - void setIsClipped(bool isClipped) { m_isClipped = isClipped; } |
| - |
| - const gfx::Rect& clipRect() const { return m_clipRect; } |
| - void setClipRect(const gfx::Rect& clipRect) { m_clipRect = clipRect; } |
| - |
| - const gfx::Rect& drawableContentRect() const { return m_drawableContentRect; } |
| - void setDrawableContentRect(const gfx::Rect& rect) { m_drawableContentRect = rect; } |
| - |
| // The contentsScale converts from logical, non-page-scaled pixels to target pixels. |
| // The contentsScale is 1 for the root layer as it is already in physical pixels. |
| // By default contentsScale is forced to be 1 except for subclasses of ContentsScalingLayer. |
| @@ -356,9 +337,6 @@ private: |
| // Layer properties. |
| gfx::Size m_bounds; |
| - // Uses layer's content space. |
| - gfx::Rect m_visibleContentRect; |
| - |
| gfx::Vector2d m_scrollOffset; |
| gfx::Vector2d m_maxScrollOffset; |
| bool m_scrollable; |
| @@ -397,22 +375,6 @@ private: |
| // Transient properties. |
| scoped_ptr<RenderSurface> m_renderSurface; |
|
danakj
2012/12/03 18:54:36
render surface is created/assigned in calcDraw. Sh
shawnsingh
2012/12/03 19:27:44
Agreed, I'll move it over
|
| - float m_drawOpacity; |
| - bool m_drawOpacityIsAnimating; |
| - |
| - Layer* m_renderTarget; |
| - |
| - gfx::Transform m_drawTransform; |
| - gfx::Transform m_screenSpaceTransform; |
| - bool m_drawTransformIsAnimating; |
| - bool m_screenSpaceTransformIsAnimating; |
| - |
| - // Uses target surface space. |
| - gfx::Rect m_drawableContentRect; |
| - gfx::Rect m_clipRect; |
| - |
| - // True if the layer is clipped by m_clipRect |
| - bool m_isClipped; |
| float m_rasterScale; |
| bool m_automaticallyComputeRasterScale; |
| @@ -422,6 +384,8 @@ private: |
| WebKit::WebAnimationDelegate* m_layerAnimationDelegate; |
| WebKit::WebLayerScrollClient* m_layerScrollClient; |
| + |
| + DrawProperties<Layer> m_drawProperties; |
| }; |
| void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped_refptr<Layer> >::iterator, void*); |