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 | 5 |
6 #ifndef CC_RENDER_SURFACE_H_ | 6 #ifndef CC_RENDER_SURFACE_H_ |
7 #define CC_RENDER_SURFACE_H_ | 7 #define CC_RENDER_SURFACE_H_ |
8 | 8 |
| 9 #include <vector> |
| 10 |
9 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
10 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "cc/cc_export.h" |
11 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
12 #include "ui/gfx/rect_f.h" | 15 #include "ui/gfx/rect_f.h" |
13 #include <public/WebTransformationMatrix.h> | 16 #include "ui/gfx/transform.h" |
14 #include <vector> | |
15 #include "cc/cc_export.h" | |
16 | 17 |
17 namespace cc { | 18 namespace cc { |
18 | 19 |
19 class Layer; | 20 class Layer; |
20 | 21 |
21 class CC_EXPORT RenderSurface { | 22 class CC_EXPORT RenderSurface { |
22 public: | 23 public: |
23 explicit RenderSurface(Layer*); | 24 explicit RenderSurface(Layer*); |
24 ~RenderSurface(); | 25 ~RenderSurface(); |
25 | 26 |
26 // Returns the rect that encloses the RenderSurfaceImpl including any reflec
tion. | 27 // Returns the rect that encloses the RenderSurfaceImpl including any reflec
tion. |
27 gfx::RectF drawableContentRect() const; | 28 gfx::RectF drawableContentRect() const; |
28 | 29 |
29 const gfx::Rect& contentRect() const { return m_contentRect; } | 30 const gfx::Rect& contentRect() const { return m_contentRect; } |
30 void setContentRect(const gfx::Rect& contentRect) { m_contentRect = contentR
ect; } | 31 void setContentRect(const gfx::Rect& contentRect) { m_contentRect = contentR
ect; } |
31 | 32 |
32 float drawOpacity() const { return m_drawOpacity; } | 33 float drawOpacity() const { return m_drawOpacity; } |
33 void setDrawOpacity(float drawOpacity) { m_drawOpacity = drawOpacity; } | 34 void setDrawOpacity(float drawOpacity) { m_drawOpacity = drawOpacity; } |
34 | 35 |
35 bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; } | 36 bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; } |
36 void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityI
sAnimating = drawOpacityIsAnimating; } | 37 void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityI
sAnimating = drawOpacityIsAnimating; } |
37 | 38 |
38 // This goes from content space with the origin in the center of the rect be
ing transformed to the target space with the origin in the top left of the | 39 // This goes from content space with the origin in the center of the rect be
ing 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 ce
nter of it before applying this transform. | 40 // rect being transformed. Position the rect so that the origin is in the ce
nter of it before applying this transform. |
40 const WebKit::WebTransformationMatrix& drawTransform() const { return m_draw
Transform; } | 41 const gfx::Transform& drawTransform() const { return m_drawTransform; } |
41 void setDrawTransform(const WebKit::WebTransformationMatrix& drawTransform)
{ m_drawTransform = drawTransform; } | 42 void setDrawTransform(const gfx::Transform& drawTransform) { m_drawTransform
= drawTransform; } |
42 | 43 |
43 const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return
m_screenSpaceTransform; } | 44 const gfx::Transform& screenSpaceTransform() const { return m_screenSpaceTra
nsform; } |
44 void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& screenSp
aceTransform) { m_screenSpaceTransform = screenSpaceTransform; } | 45 void setScreenSpaceTransform(const gfx::Transform& screenSpaceTransform) { m
_screenSpaceTransform = screenSpaceTransform; } |
45 | 46 |
46 const WebKit::WebTransformationMatrix& replicaDrawTransform() const { return
m_replicaDrawTransform; } | 47 const gfx::Transform& replicaDrawTransform() const { return m_replicaDrawTra
nsform; } |
47 void setReplicaDrawTransform(const WebKit::WebTransformationMatrix& replicaD
rawTransform) { m_replicaDrawTransform = replicaDrawTransform; } | 48 void setReplicaDrawTransform(const gfx::Transform& replicaDrawTransform) { m
_replicaDrawTransform = replicaDrawTransform; } |
48 | 49 |
49 const WebKit::WebTransformationMatrix& replicaScreenSpaceTransform() const {
return m_replicaScreenSpaceTransform; } | 50 const gfx::Transform& replicaScreenSpaceTransform() const { return m_replica
ScreenSpaceTransform; } |
50 void setReplicaScreenSpaceTransform(const WebKit::WebTransformationMatrix& r
eplicaScreenSpaceTransform) { m_replicaScreenSpaceTransform = replicaScreenSpace
Transform; } | 51 void setReplicaScreenSpaceTransform(const gfx::Transform& replicaScreenSpace
Transform) { m_replicaScreenSpaceTransform = replicaScreenSpaceTransform; } |
51 | 52 |
52 bool targetSurfaceTransformsAreAnimating() const { return m_targetSurfaceTra
nsformsAreAnimating; } | 53 bool targetSurfaceTransformsAreAnimating() const { return m_targetSurfaceTra
nsformsAreAnimating; } |
53 void setTargetSurfaceTransformsAreAnimating(bool animating) { m_targetSurfac
eTransformsAreAnimating = animating; } | 54 void setTargetSurfaceTransformsAreAnimating(bool animating) { m_targetSurfac
eTransformsAreAnimating = animating; } |
54 bool screenSpaceTransformsAreAnimating() const { return m_screenSpaceTransfo
rmsAreAnimating; } | 55 bool screenSpaceTransformsAreAnimating() const { return m_screenSpaceTransfo
rmsAreAnimating; } |
55 void setScreenSpaceTransformsAreAnimating(bool animating) { m_screenSpaceTra
nsformsAreAnimating = animating; } | 56 void setScreenSpaceTransformsAreAnimating(bool animating) { m_screenSpaceTra
nsformsAreAnimating = animating; } |
56 | 57 |
57 const gfx::Rect& clipRect() const { return m_clipRect; } | 58 const gfx::Rect& clipRect() const { return m_clipRect; } |
58 void setClipRect(const gfx::Rect& clipRect) { m_clipRect = clipRect; } | 59 void setClipRect(const gfx::Rect& clipRect) { m_clipRect = clipRect; } |
59 | 60 |
60 typedef std::vector<scoped_refptr<Layer> > LayerList; | 61 typedef std::vector<scoped_refptr<Layer> > LayerList; |
61 LayerList& layerList() { return m_layerList; } | 62 LayerList& layerList() { return m_layerList; } |
62 // A no-op since DelegatedRendererLayers on the main thread don't have any | 63 // A no-op since DelegatedRendererLayers on the main thread don't have any |
63 // RenderPasses so they can't contribute to a surface. | 64 // RenderPasses so they can't contribute to a surface. |
64 void addContributingDelegatedRenderPassLayer(Layer*) { } | 65 void addContributingDelegatedRenderPassLayer(Layer*) { } |
65 void clearLayerLists() { m_layerList.clear(); } | 66 void clearLayerLists() { m_layerList.clear(); } |
66 | 67 |
67 void setNearestAncestorThatMovesPixels(RenderSurface* surface) { m_nearestAn
cestorThatMovesPixels = surface; } | 68 void setNearestAncestorThatMovesPixels(RenderSurface* surface) { m_nearestAn
cestorThatMovesPixels = surface; } |
68 const RenderSurface* nearestAncestorThatMovesPixels() const { return m_neare
stAncestorThatMovesPixels; } | 69 const RenderSurface* nearestAncestorThatMovesPixels() const { return m_neare
stAncestorThatMovesPixels; } |
69 | 70 |
70 private: | 71 private: |
71 friend struct LayerIteratorActions; | 72 friend struct LayerIteratorActions; |
72 | 73 |
73 Layer* m_owningLayer; | 74 Layer* m_owningLayer; |
74 | 75 |
75 // Uses this surface's space. | 76 // Uses this surface's space. |
76 gfx::Rect m_contentRect; | 77 gfx::Rect m_contentRect; |
77 | 78 |
78 float m_drawOpacity; | 79 float m_drawOpacity; |
79 bool m_drawOpacityIsAnimating; | 80 bool m_drawOpacityIsAnimating; |
80 WebKit::WebTransformationMatrix m_drawTransform; | 81 gfx::Transform m_drawTransform; |
81 WebKit::WebTransformationMatrix m_screenSpaceTransform; | 82 gfx::Transform m_screenSpaceTransform; |
82 WebKit::WebTransformationMatrix m_replicaDrawTransform; | 83 gfx::Transform m_replicaDrawTransform; |
83 WebKit::WebTransformationMatrix m_replicaScreenSpaceTransform; | 84 gfx::Transform m_replicaScreenSpaceTransform; |
84 bool m_targetSurfaceTransformsAreAnimating; | 85 bool m_targetSurfaceTransformsAreAnimating; |
85 bool m_screenSpaceTransformsAreAnimating; | 86 bool m_screenSpaceTransformsAreAnimating; |
86 | 87 |
87 // Uses the space of the surface's target surface. | 88 // Uses the space of the surface's target surface. |
88 gfx::Rect m_clipRect; | 89 gfx::Rect m_clipRect; |
89 | 90 |
90 LayerList m_layerList; | 91 LayerList m_layerList; |
91 | 92 |
92 // The nearest ancestor target surface that will contain the contents of thi
s surface, and that is going | 93 // The nearest ancestor target surface that will contain the contents of thi
s surface, and that is going |
93 // to move pixels within the surface (such as with a blur). This can point t
o itself. | 94 // to move pixels within the surface (such as with a blur). This can point t
o itself. |
94 RenderSurface* m_nearestAncestorThatMovesPixels; | 95 RenderSurface* m_nearestAncestorThatMovesPixels; |
95 | 96 |
96 // For LayerIteratorActions | 97 // For LayerIteratorActions |
97 int m_targetRenderSurfaceLayerIndexHistory; | 98 int m_targetRenderSurfaceLayerIndexHistory; |
98 int m_currentLayerIndexHistory; | 99 int m_currentLayerIndexHistory; |
99 | 100 |
100 DISALLOW_COPY_AND_ASSIGN(RenderSurface); | 101 DISALLOW_COPY_AND_ASSIGN(RenderSurface); |
101 }; | 102 }; |
102 | 103 |
103 } | 104 } |
104 #endif // CC_RENDER_SURFACE_H_ | 105 #endif // CC_RENDER_SURFACE_H_ |
OLD | NEW |