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