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