WebKit merge 128969:128981
[chromium-blink-merge.git] / cc / CCRenderSurface.h
blob55dc48390041283afbdc16d9ee9bb07739bac38d
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
3 // found in the LICENSE file.
6 #ifndef CCRenderSurface_h
7 #define CCRenderSurface_h
9 #if USE(ACCELERATED_COMPOSITING)
11 #include "CCRenderPass.h"
12 #include "CCSharedQuadState.h"
13 #include "FloatRect.h"
14 #include "IntRect.h"
15 #include <public/WebTransformationMatrix.h>
16 #include <wtf/Noncopyable.h>
18 namespace cc {
20 class CCDamageTracker;
21 class CCQuadSink;
22 class CCRenderPassSink;
23 class CCLayerImpl;
25 struct CCAppendQuadsData;
27 class CCRenderSurface {
28 WTF_MAKE_NONCOPYABLE(CCRenderSurface);
29 public:
30 explicit CCRenderSurface(CCLayerImpl*);
31 virtual ~CCRenderSurface();
33 std::string name() const;
34 void dumpSurface(std::string*, int indent) const;
36 FloatPoint contentRectCenter() const { return FloatRect(m_contentRect).center(); }
38 // Returns the rect that encloses the RenderSurface including any reflection.
39 FloatRect drawableContentRect() const;
41 float drawOpacity() const { return m_drawOpacity; }
42 void setDrawOpacity(float opacity) { m_drawOpacity = opacity; }
44 void setNearestAncestorThatMovesPixels(CCRenderSurface* surface) { m_nearestAncestorThatMovesPixels = surface; }
45 const CCRenderSurface* nearestAncestorThatMovesPixels() const { return m_nearestAncestorThatMovesPixels; }
47 bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; }
48 void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityIsAnimating = drawOpacityIsAnimating; }
50 void setDrawTransform(const WebKit::WebTransformationMatrix& drawTransform) { m_drawTransform = drawTransform; }
51 const WebKit::WebTransformationMatrix& drawTransform() const { return m_drawTransform; }
53 void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& screenSpaceTransform) { m_screenSpaceTransform = screenSpaceTransform; }
54 const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; }
56 void setReplicaDrawTransform(const WebKit::WebTransformationMatrix& replicaDrawTransform) { m_replicaDrawTransform = replicaDrawTransform; }
57 const WebKit::WebTransformationMatrix& replicaDrawTransform() const { return m_replicaDrawTransform; }
59 void setReplicaScreenSpaceTransform(const WebKit::WebTransformationMatrix& replicaScreenSpaceTransform) { m_replicaScreenSpaceTransform = replicaScreenSpaceTransform; }
60 const WebKit::WebTransformationMatrix& replicaScreenSpaceTransform() const { return m_replicaScreenSpaceTransform; }
62 bool targetSurfaceTransformsAreAnimating() const { return m_targetSurfaceTransformsAreAnimating; }
63 void setTargetSurfaceTransformsAreAnimating(bool animating) { m_targetSurfaceTransformsAreAnimating = animating; }
64 bool screenSpaceTransformsAreAnimating() const { return m_screenSpaceTransformsAreAnimating; }
65 void setScreenSpaceTransformsAreAnimating(bool animating) { m_screenSpaceTransformsAreAnimating = animating; }
67 void setClipRect(const IntRect&);
68 const IntRect& clipRect() const { return m_clipRect; }
70 bool contentsChanged() const;
72 void setContentRect(const IntRect&);
73 const IntRect& contentRect() const { return m_contentRect; }
75 void clearLayerList() { m_layerList.clear(); }
76 Vector<CCLayerImpl*>& layerList() { return m_layerList; }
78 int owningLayerId() const;
80 void resetPropertyChangedFlag() { m_surfacePropertyChanged = false; }
81 bool surfacePropertyChanged() const;
82 bool surfacePropertyChangedOnlyFromDescendant() const;
84 CCDamageTracker* damageTracker() const { return m_damageTracker.get(); }
86 CCRenderPass::Id renderPassId();
88 void appendRenderPasses(CCRenderPassSink&);
89 void appendQuads(CCQuadSink&, CCAppendQuadsData&, bool forReplica, CCRenderPass::Id renderPassId);
91 private:
92 CCLayerImpl* m_owningLayer;
94 // Uses this surface's space.
95 IntRect m_contentRect;
96 bool m_surfacePropertyChanged;
98 float m_drawOpacity;
99 bool m_drawOpacityIsAnimating;
100 WebKit::WebTransformationMatrix m_drawTransform;
101 WebKit::WebTransformationMatrix m_screenSpaceTransform;
102 WebKit::WebTransformationMatrix m_replicaDrawTransform;
103 WebKit::WebTransformationMatrix m_replicaScreenSpaceTransform;
104 bool m_targetSurfaceTransformsAreAnimating;
105 bool m_screenSpaceTransformsAreAnimating;
107 // Uses the space of the surface's target surface.
108 IntRect m_clipRect;
110 Vector<CCLayerImpl*> m_layerList;
112 // The nearest ancestor target surface that will contain the contents of this surface, and that is going
113 // to move pixels within the surface (such as with a blur). This can point to itself.
114 CCRenderSurface* m_nearestAncestorThatMovesPixels;
116 OwnPtr<CCDamageTracker> m_damageTracker;
118 // For CCLayerIteratorActions
119 int m_targetRenderSurfaceLayerIndexHistory;
120 int m_currentLayerIndexHistory;
122 friend struct CCLayerIteratorActions;
126 #endif // USE(ACCELERATED_COMPOSITING)
128 #endif