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
3 // found in the LICENSE file.
6 #ifndef RenderSurfaceChromium_h
7 #define RenderSurfaceChromium_h
9 #if USE(ACCELERATED_COMPOSITING)
11 #include "FloatRect.h"
13 #include <public/WebTransformationMatrix.h>
14 #include <wtf/Noncopyable.h>
20 class RenderSurfaceChromium
{
21 WTF_MAKE_NONCOPYABLE(RenderSurfaceChromium
);
23 explicit RenderSurfaceChromium(LayerChromium
*);
24 ~RenderSurfaceChromium();
26 // Returns the rect that encloses the RenderSurface including any reflection.
27 FloatRect
drawableContentRect() const;
29 const IntRect
& contentRect() const { return m_contentRect
; }
30 void setContentRect(const IntRect
& contentRect
) { m_contentRect
= contentRect
; }
32 float drawOpacity() const { return m_drawOpacity
; }
33 void setDrawOpacity(float drawOpacity
) { m_drawOpacity
= drawOpacity
; }
35 bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating
; }
36 void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating
) { m_drawOpacityIsAnimating
= drawOpacityIsAnimating
; }
38 // This goes from content space with the origin in the center of the rect being transformed to the target space with the origin in the top left of the
39 // rect being transformed. Position the rect so that the origin is in the center of it before applying this transform.
40 const WebKit::WebTransformationMatrix
& drawTransform() const { return m_drawTransform
; }
41 void setDrawTransform(const WebKit::WebTransformationMatrix
& drawTransform
) { m_drawTransform
= drawTransform
; }
43 const WebKit::WebTransformationMatrix
& screenSpaceTransform() const { return m_screenSpaceTransform
; }
44 void setScreenSpaceTransform(const WebKit::WebTransformationMatrix
& screenSpaceTransform
) { m_screenSpaceTransform
= screenSpaceTransform
; }
46 const WebKit::WebTransformationMatrix
& replicaDrawTransform() const { return m_replicaDrawTransform
; }
47 void setReplicaDrawTransform(const WebKit::WebTransformationMatrix
& replicaDrawTransform
) { m_replicaDrawTransform
= replicaDrawTransform
; }
49 const WebKit::WebTransformationMatrix
& replicaScreenSpaceTransform() const { return m_replicaScreenSpaceTransform
; }
50 void setReplicaScreenSpaceTransform(const WebKit::WebTransformationMatrix
& replicaScreenSpaceTransform
) { m_replicaScreenSpaceTransform
= replicaScreenSpaceTransform
; }
52 bool targetSurfaceTransformsAreAnimating() const { return m_targetSurfaceTransformsAreAnimating
; }
53 void setTargetSurfaceTransformsAreAnimating(bool animating
) { m_targetSurfaceTransformsAreAnimating
= animating
; }
54 bool screenSpaceTransformsAreAnimating() const { return m_screenSpaceTransformsAreAnimating
; }
55 void setScreenSpaceTransformsAreAnimating(bool animating
) { m_screenSpaceTransformsAreAnimating
= animating
; }
57 const IntRect
& clipRect() const { return m_clipRect
; }
58 void setClipRect(const IntRect
& clipRect
) { m_clipRect
= clipRect
; }
60 void clearLayerList() { m_layerList
.clear(); }
61 Vector
<RefPtr
<LayerChromium
> >& layerList() { return m_layerList
; }
63 void setNearestAncestorThatMovesPixels(RenderSurfaceChromium
* surface
) { m_nearestAncestorThatMovesPixels
= surface
; }
64 const RenderSurfaceChromium
* nearestAncestorThatMovesPixels() const { return m_nearestAncestorThatMovesPixels
; }
67 LayerChromium
* m_owningLayer
;
69 // Uses this surface's space.
70 IntRect m_contentRect
;
73 bool m_drawOpacityIsAnimating
;
74 WebKit::WebTransformationMatrix m_drawTransform
;
75 WebKit::WebTransformationMatrix m_screenSpaceTransform
;
76 WebKit::WebTransformationMatrix m_replicaDrawTransform
;
77 WebKit::WebTransformationMatrix m_replicaScreenSpaceTransform
;
78 bool m_targetSurfaceTransformsAreAnimating
;
79 bool m_screenSpaceTransformsAreAnimating
;
81 // Uses the space of the surface's target surface.
84 Vector
<RefPtr
<LayerChromium
> > m_layerList
;
86 // The nearest ancestor target surface that will contain the contents of this surface, and that is going
87 // to move pixels within the surface (such as with a blur). This can point to itself.
88 RenderSurfaceChromium
* m_nearestAncestorThatMovesPixels
;
90 // For CCLayerIteratorActions
91 int m_targetRenderSurfaceLayerIndexHistory
;
92 int m_currentLayerIndexHistory
;
93 friend struct CCLayerIteratorActions
;
97 #endif // USE(ACCELERATED_COMPOSITING)