| 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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "CCRenderPass.h" | 10 #include "CCRenderPass.h" |
| 11 #include "CCSharedQuadState.h" | 11 #include "CCSharedQuadState.h" |
| 12 #include "FloatRect.h" | 12 #include "FloatRect.h" |
| 13 #include "IntRect.h" | 13 #include "IntRect.h" |
| 14 #include <public/WebTransformationMatrix.h> | 14 #include <public/WebTransformationMatrix.h> |
| 15 | 15 |
| 16 namespace cc { | 16 namespace cc { |
| 17 | 17 |
| 18 class CCDamageTracker; | 18 class DamageTracker; |
| 19 class CCDelegatedRendererLayerImpl; | 19 class DelegatedRendererLayerImpl; |
| 20 class CCQuadSink; | 20 class QuadSink; |
| 21 class CCRenderPassSink; | 21 class RenderPassSink; |
| 22 class CCLayerImpl; | 22 class LayerImpl; |
| 23 | 23 |
| 24 struct CCAppendQuadsData; | 24 struct AppendQuadsData; |
| 25 | 25 |
| 26 class CCRenderSurface { | 26 class RenderSurfaceImpl { |
| 27 public: | 27 public: |
| 28 explicit CCRenderSurface(CCLayerImpl*); | 28 explicit RenderSurfaceImpl(LayerImpl*); |
| 29 virtual ~CCRenderSurface(); | 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 FloatPoint contentRectCenter() const { return FloatRect(m_contentRect).cente
r(); } |
| 35 | 35 |
| 36 // Returns the rect that encloses the RenderSurface including any reflection
. | 36 // Returns the rect that encloses the RenderSurfaceImpl including any reflec
tion. |
| 37 FloatRect drawableContentRect() const; | 37 FloatRect 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(CCRenderSurface* surface) { m_nearest
AncestorThatMovesPixels = surface; } | 42 void setNearestAncestorThatMovesPixels(RenderSurfaceImpl* surface) { m_neare
stAncestorThatMovesPixels = surface; } |
| 43 const CCRenderSurface* nearestAncestorThatMovesPixels() const { return m_nea
restAncestorThatMovesPixels; } | 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 IntRect&); |
| 66 const IntRect& clipRect() const { return m_clipRect; } | 66 const IntRect& 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 IntRect&); |
| 71 const IntRect& contentRect() const { return m_contentRect; } | 71 const IntRect& contentRect() const { return m_contentRect; } |
| 72 | 72 |
| 73 std::vector<CCLayerImpl*>& layerList() { return m_layerList; } | 73 std::vector<LayerImpl*>& layerList() { return m_layerList; } |
| 74 void addContributingDelegatedRenderPassLayer(CCLayerImpl*); | 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 CCDamageTracker* damageTracker() const { return m_damageTracker.get(); } | 83 DamageTracker* damageTracker() const { return m_damageTracker.get(); } |
| 84 | 84 |
| 85 CCRenderPass::Id renderPassId(); | 85 RenderPass::Id renderPassId(); |
| 86 | 86 |
| 87 void appendRenderPasses(CCRenderPassSink&); | 87 void appendRenderPasses(RenderPassSink&); |
| 88 void appendQuads(CCQuadSink&, CCAppendQuadsData&, bool forReplica, CCRenderP
ass::Id renderPassId); | 88 void appendQuads(QuadSink&, AppendQuadsData&, bool forReplica, RenderPass::I
d renderPassId); |
| 89 | 89 |
| 90 private: | 90 private: |
| 91 CCLayerImpl* 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 IntRect 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 IntRect m_clipRect; |
| 108 | 108 |
| 109 std::vector<CCLayerImpl*> m_layerList; | 109 std::vector<LayerImpl*> m_layerList; |
| 110 std::vector<CCDelegatedRendererLayerImpl*> m_contributingDelegatedRenderPass
LayerList; | 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 CCRenderSurface* m_nearestAncestorThatMovesPixels; | 114 RenderSurfaceImpl* m_nearestAncestorThatMovesPixels; |
| 115 | 115 |
| 116 scoped_ptr<CCDamageTracker> m_damageTracker; | 116 scoped_ptr<DamageTracker> m_damageTracker; |
| 117 | 117 |
| 118 // For CCLayerIteratorActions | 118 // For LayerIteratorActions |
| 119 int m_targetRenderSurfaceLayerIndexHistory; | 119 int m_targetRenderSurfaceLayerIndexHistory; |
| 120 int m_currentLayerIndexHistory; | 120 int m_currentLayerIndexHistory; |
| 121 | 121 |
| 122 friend struct CCLayerIteratorActions; | 122 friend struct LayerIteratorActions; |
| 123 | 123 |
| 124 DISALLOW_COPY_AND_ASSIGN(CCRenderSurface); | 124 DISALLOW_COPY_AND_ASSIGN(RenderSurfaceImpl); |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 } | 127 } |
| 128 #endif | 128 #endif |
| OLD | NEW |