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