OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 CCRenderSurface_h | 5 #ifndef CCRenderSurface_h |
6 #define CCRenderSurface_h | 6 #define CCRenderSurface_h |
7 | 7 |
8 #include "FloatRect.h" | |
9 #include "IntRect.h" | |
10 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
11 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
12 #include "cc/render_pass.h" | 10 #include "cc/render_pass.h" |
13 #include "cc/shared_quad_state.h" | 11 #include "cc/shared_quad_state.h" |
| 12 #include "ui/gfx/rect.h" |
| 13 #include "ui/gfx/rect_f.h" |
14 #include <public/WebTransformationMatrix.h> | 14 #include <public/WebTransformationMatrix.h> |
15 | 15 |
16 namespace cc { | 16 namespace cc { |
17 | 17 |
18 class DamageTracker; | 18 class DamageTracker; |
19 class DelegatedRendererLayerImpl; | 19 class DelegatedRendererLayerImpl; |
20 class QuadSink; | 20 class QuadSink; |
21 class RenderPassSink; | 21 class RenderPassSink; |
22 class LayerImpl; | 22 class LayerImpl; |
23 | 23 |
24 struct AppendQuadsData; | 24 struct AppendQuadsData; |
25 | 25 |
26 class RenderSurfaceImpl { | 26 class RenderSurfaceImpl { |
27 public: | 27 public: |
28 explicit RenderSurfaceImpl(LayerImpl*); | 28 explicit RenderSurfaceImpl(LayerImpl*); |
29 virtual ~RenderSurfaceImpl(); | 29 virtual ~RenderSurfaceImpl(); |
30 | 30 |
31 std::string name() const; | 31 std::string name() const; |
32 void dumpSurface(std::string*, int indent) const; | 32 void dumpSurface(std::string*, int indent) const; |
33 | 33 |
34 FloatPoint contentRectCenter() const { return FloatRect(m_contentRect).cente
r(); } | 34 gfx::PointF contentRectCenter() const { return gfx::RectF(m_contentRect).Cen
terPoint(); } |
35 | 35 |
36 // Returns the rect that encloses the RenderSurfaceImpl including any reflec
tion. | 36 // Returns the rect that encloses the RenderSurfaceImpl including any reflec
tion. |
37 FloatRect drawableContentRect() const; | 37 gfx::RectF drawableContentRect() const; |
38 | 38 |
39 float drawOpacity() const { return m_drawOpacity; } | 39 float drawOpacity() const { return m_drawOpacity; } |
40 void setDrawOpacity(float opacity) { m_drawOpacity = opacity; } | 40 void setDrawOpacity(float opacity) { m_drawOpacity = opacity; } |
41 | 41 |
42 void setNearestAncestorThatMovesPixels(RenderSurfaceImpl* surface) { m_neare
stAncestorThatMovesPixels = surface; } | 42 void setNearestAncestorThatMovesPixels(RenderSurfaceImpl* surface) { m_neare
stAncestorThatMovesPixels = surface; } |
43 const RenderSurfaceImpl* nearestAncestorThatMovesPixels() const { return m_n
earestAncestorThatMovesPixels; } | 43 const RenderSurfaceImpl* nearestAncestorThatMovesPixels() const { return m_n
earestAncestorThatMovesPixels; } |
44 | 44 |
45 bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; } | 45 bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; } |
46 void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityI
sAnimating = drawOpacityIsAnimating; } | 46 void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityI
sAnimating = drawOpacityIsAnimating; } |
47 | 47 |
48 void setDrawTransform(const WebKit::WebTransformationMatrix& drawTransform)
{ m_drawTransform = drawTransform; } | 48 void setDrawTransform(const WebKit::WebTransformationMatrix& drawTransform)
{ m_drawTransform = drawTransform; } |
49 const WebKit::WebTransformationMatrix& drawTransform() const { return m_draw
Transform; } | 49 const WebKit::WebTransformationMatrix& drawTransform() const { return m_draw
Transform; } |
50 | 50 |
51 void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& screenSp
aceTransform) { m_screenSpaceTransform = screenSpaceTransform; } | 51 void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& screenSp
aceTransform) { m_screenSpaceTransform = screenSpaceTransform; } |
52 const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return
m_screenSpaceTransform; } | 52 const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return
m_screenSpaceTransform; } |
53 | 53 |
54 void setReplicaDrawTransform(const WebKit::WebTransformationMatrix& replicaD
rawTransform) { m_replicaDrawTransform = replicaDrawTransform; } | 54 void setReplicaDrawTransform(const WebKit::WebTransformationMatrix& replicaD
rawTransform) { m_replicaDrawTransform = replicaDrawTransform; } |
55 const WebKit::WebTransformationMatrix& replicaDrawTransform() const { return
m_replicaDrawTransform; } | 55 const WebKit::WebTransformationMatrix& replicaDrawTransform() const { return
m_replicaDrawTransform; } |
56 | 56 |
57 void setReplicaScreenSpaceTransform(const WebKit::WebTransformationMatrix& r
eplicaScreenSpaceTransform) { m_replicaScreenSpaceTransform = replicaScreenSpace
Transform; } | 57 void setReplicaScreenSpaceTransform(const WebKit::WebTransformationMatrix& r
eplicaScreenSpaceTransform) { m_replicaScreenSpaceTransform = replicaScreenSpace
Transform; } |
58 const WebKit::WebTransformationMatrix& replicaScreenSpaceTransform() const {
return m_replicaScreenSpaceTransform; } | 58 const WebKit::WebTransformationMatrix& replicaScreenSpaceTransform() const {
return m_replicaScreenSpaceTransform; } |
59 | 59 |
60 bool targetSurfaceTransformsAreAnimating() const { return m_targetSurfaceTra
nsformsAreAnimating; } | 60 bool targetSurfaceTransformsAreAnimating() const { return m_targetSurfaceTra
nsformsAreAnimating; } |
61 void setTargetSurfaceTransformsAreAnimating(bool animating) { m_targetSurfac
eTransformsAreAnimating = animating; } | 61 void setTargetSurfaceTransformsAreAnimating(bool animating) { m_targetSurfac
eTransformsAreAnimating = animating; } |
62 bool screenSpaceTransformsAreAnimating() const { return m_screenSpaceTransfo
rmsAreAnimating; } | 62 bool screenSpaceTransformsAreAnimating() const { return m_screenSpaceTransfo
rmsAreAnimating; } |
63 void setScreenSpaceTransformsAreAnimating(bool animating) { m_screenSpaceTra
nsformsAreAnimating = animating; } | 63 void setScreenSpaceTransformsAreAnimating(bool animating) { m_screenSpaceTra
nsformsAreAnimating = animating; } |
64 | 64 |
65 void setClipRect(const IntRect&); | 65 void setClipRect(const gfx::Rect&); |
66 const IntRect& clipRect() const { return m_clipRect; } | 66 const gfx::Rect& clipRect() const { return m_clipRect; } |
67 | 67 |
68 bool contentsChanged() const; | 68 bool contentsChanged() const; |
69 | 69 |
70 void setContentRect(const IntRect&); | 70 void setContentRect(const gfx::Rect&); |
71 const IntRect& contentRect() const { return m_contentRect; } | 71 const gfx::Rect& contentRect() const { return m_contentRect; } |
72 | 72 |
73 std::vector<LayerImpl*>& layerList() { return m_layerList; } | 73 std::vector<LayerImpl*>& layerList() { return m_layerList; } |
74 void addContributingDelegatedRenderPassLayer(LayerImpl*); | 74 void addContributingDelegatedRenderPassLayer(LayerImpl*); |
75 void clearLayerLists(); | 75 void clearLayerLists(); |
76 | 76 |
77 int owningLayerId() const; | 77 int owningLayerId() const; |
78 | 78 |
79 void resetPropertyChangedFlag() { m_surfacePropertyChanged = false; } | 79 void resetPropertyChangedFlag() { m_surfacePropertyChanged = false; } |
80 bool surfacePropertyChanged() const; | 80 bool surfacePropertyChanged() const; |
81 bool surfacePropertyChangedOnlyFromDescendant() const; | 81 bool surfacePropertyChangedOnlyFromDescendant() const; |
82 | 82 |
83 DamageTracker* damageTracker() const { return m_damageTracker.get(); } | 83 DamageTracker* damageTracker() const { return m_damageTracker.get(); } |
84 | 84 |
85 RenderPass::Id renderPassId(); | 85 RenderPass::Id renderPassId(); |
86 | 86 |
87 void appendRenderPasses(RenderPassSink&); | 87 void appendRenderPasses(RenderPassSink&); |
88 void appendQuads(QuadSink&, AppendQuadsData&, bool forReplica, RenderPass::I
d renderPassId); | 88 void appendQuads(QuadSink&, AppendQuadsData&, bool forReplica, RenderPass::I
d renderPassId); |
89 | 89 |
90 private: | 90 private: |
91 LayerImpl* m_owningLayer; | 91 LayerImpl* m_owningLayer; |
92 | 92 |
93 // Uses this surface's space. | 93 // Uses this surface's space. |
94 IntRect m_contentRect; | 94 gfx::Rect m_contentRect; |
95 bool m_surfacePropertyChanged; | 95 bool m_surfacePropertyChanged; |
96 | 96 |
97 float m_drawOpacity; | 97 float m_drawOpacity; |
98 bool m_drawOpacityIsAnimating; | 98 bool m_drawOpacityIsAnimating; |
99 WebKit::WebTransformationMatrix m_drawTransform; | 99 WebKit::WebTransformationMatrix m_drawTransform; |
100 WebKit::WebTransformationMatrix m_screenSpaceTransform; | 100 WebKit::WebTransformationMatrix m_screenSpaceTransform; |
101 WebKit::WebTransformationMatrix m_replicaDrawTransform; | 101 WebKit::WebTransformationMatrix m_replicaDrawTransform; |
102 WebKit::WebTransformationMatrix m_replicaScreenSpaceTransform; | 102 WebKit::WebTransformationMatrix m_replicaScreenSpaceTransform; |
103 bool m_targetSurfaceTransformsAreAnimating; | 103 bool m_targetSurfaceTransformsAreAnimating; |
104 bool m_screenSpaceTransformsAreAnimating; | 104 bool m_screenSpaceTransformsAreAnimating; |
105 | 105 |
106 // Uses the space of the surface's target surface. | 106 // Uses the space of the surface's target surface. |
107 IntRect m_clipRect; | 107 gfx::Rect m_clipRect; |
108 | 108 |
109 std::vector<LayerImpl*> m_layerList; | 109 std::vector<LayerImpl*> m_layerList; |
110 std::vector<DelegatedRendererLayerImpl*> m_contributingDelegatedRenderPassLa
yerList; | 110 std::vector<DelegatedRendererLayerImpl*> m_contributingDelegatedRenderPassLa
yerList; |
111 | 111 |
112 // The nearest ancestor target surface that will contain the contents of thi
s surface, and that is going | 112 // The nearest ancestor target surface that will contain the contents of thi
s surface, and that is going |
113 // to move pixels within the surface (such as with a blur). This can point t
o itself. | 113 // to move pixels within the surface (such as with a blur). This can point t
o itself. |
114 RenderSurfaceImpl* m_nearestAncestorThatMovesPixels; | 114 RenderSurfaceImpl* m_nearestAncestorThatMovesPixels; |
115 | 115 |
116 scoped_ptr<DamageTracker> m_damageTracker; | 116 scoped_ptr<DamageTracker> m_damageTracker; |
117 | 117 |
118 // For LayerIteratorActions | 118 // For LayerIteratorActions |
119 int m_targetRenderSurfaceLayerIndexHistory; | 119 int m_targetRenderSurfaceLayerIndexHistory; |
120 int m_currentLayerIndexHistory; | 120 int m_currentLayerIndexHistory; |
121 | 121 |
122 friend struct LayerIteratorActions; | 122 friend struct LayerIteratorActions; |
123 | 123 |
124 DISALLOW_COPY_AND_ASSIGN(RenderSurfaceImpl); | 124 DISALLOW_COPY_AND_ASSIGN(RenderSurfaceImpl); |
125 }; | 125 }; |
126 | 126 |
127 } | 127 } |
128 #endif | 128 #endif |
OLD | NEW |