OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * |
| 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions |
| 6 * are met: |
| 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright |
| 11 * notice, this list of conditions and the following disclaimer in the |
| 12 * documentation and/or other materials provided with the distribution. |
| 13 * |
| 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY |
| 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
| 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ |
| 25 |
| 26 |
| 27 #ifndef RenderSurfaceChromium_h |
| 28 #define RenderSurfaceChromium_h |
| 29 |
| 30 #if USE(ACCELERATED_COMPOSITING) |
| 31 |
| 32 #include "FloatRect.h" |
| 33 #include "IntRect.h" |
| 34 #include <public/WebFilterOperations.h> |
| 35 #include <public/WebTransformationMatrix.h> |
| 36 #include <wtf/Noncopyable.h> |
| 37 |
| 38 namespace WebCore { |
| 39 |
| 40 class FilterOperations; |
| 41 class LayerChromium; |
| 42 class LayerRendererChromium; |
| 43 class ManagedTexture; |
| 44 |
| 45 class RenderSurfaceChromium { |
| 46 WTF_MAKE_NONCOPYABLE(RenderSurfaceChromium); |
| 47 public: |
| 48 explicit RenderSurfaceChromium(LayerChromium*); |
| 49 ~RenderSurfaceChromium(); |
| 50 |
| 51 // Returns the rect that encloses the RenderSurface including any reflection
. |
| 52 FloatRect drawableContentRect() const; |
| 53 |
| 54 const IntRect& contentRect() const { return m_contentRect; } |
| 55 void setContentRect(const IntRect& contentRect) { m_contentRect = contentRec
t; } |
| 56 |
| 57 float drawOpacity() const { return m_drawOpacity; } |
| 58 void setDrawOpacity(float drawOpacity) { m_drawOpacity = drawOpacity; } |
| 59 |
| 60 bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; } |
| 61 void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityI
sAnimating = drawOpacityIsAnimating; } |
| 62 |
| 63 // 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 |
| 64 // rect being transformed. Position the rect so that the origin is in the ce
nter of it before applying this transform. |
| 65 const WebKit::WebTransformationMatrix& drawTransform() const { return m_draw
Transform; } |
| 66 void setDrawTransform(const WebKit::WebTransformationMatrix& drawTransform)
{ m_drawTransform = drawTransform; } |
| 67 |
| 68 const WebKit::WebTransformationMatrix& originTransform() const { return m_or
iginTransform; } |
| 69 void setOriginTransform(const WebKit::WebTransformationMatrix& originTransfo
rm) { m_originTransform = originTransform; } |
| 70 |
| 71 const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return
m_screenSpaceTransform; } |
| 72 void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& screenSp
aceTransform) { m_screenSpaceTransform = screenSpaceTransform; } |
| 73 |
| 74 const WebKit::WebTransformationMatrix& replicaDrawTransform() const { return
m_replicaDrawTransform; } |
| 75 void setReplicaDrawTransform(const WebKit::WebTransformationMatrix& replicaD
rawTransform) { m_replicaDrawTransform = replicaDrawTransform; } |
| 76 |
| 77 const WebKit::WebTransformationMatrix& replicaOriginTransform() const { retu
rn m_replicaOriginTransform; } |
| 78 void setReplicaOriginTransform(const WebKit::WebTransformationMatrix& replic
aOriginTransform) { m_replicaOriginTransform = replicaOriginTransform; } |
| 79 |
| 80 const WebKit::WebTransformationMatrix& replicaScreenSpaceTransform() const {
return m_replicaScreenSpaceTransform; } |
| 81 void setReplicaScreenSpaceTransform(const WebKit::WebTransformationMatrix& r
eplicaScreenSpaceTransform) { m_replicaScreenSpaceTransform = replicaScreenSpace
Transform; } |
| 82 |
| 83 bool targetSurfaceTransformsAreAnimating() const { return m_targetSurfaceTra
nsformsAreAnimating; } |
| 84 void setTargetSurfaceTransformsAreAnimating(bool animating) { m_targetSurfac
eTransformsAreAnimating = animating; } |
| 85 bool screenSpaceTransformsAreAnimating() const { return m_screenSpaceTransfo
rmsAreAnimating; } |
| 86 void setScreenSpaceTransformsAreAnimating(bool animating) { m_screenSpaceTra
nsformsAreAnimating = animating; } |
| 87 |
| 88 const IntRect& clipRect() const { return m_clipRect; } |
| 89 void setClipRect(const IntRect& clipRect) { m_clipRect = clipRect; } |
| 90 |
| 91 const IntRect& scissorRect() const { return m_scissorRect; } |
| 92 void setScissorRect(const IntRect& scissorRect) { m_scissorRect = scissorRec
t; } |
| 93 |
| 94 void setFilters(const WebKit::WebFilterOperations& filters) { m_filters = fi
lters; } |
| 95 const WebKit::WebFilterOperations& filters() const { return m_filters; } |
| 96 |
| 97 void setBackgroundFilters(const WebKit::WebFilterOperations& filters) { m_ba
ckgroundFilters = filters; } |
| 98 const WebKit::WebFilterOperations& backgroundFilters() const { return m_back
groundFilters; } |
| 99 |
| 100 bool skipsDraw() const { return m_skipsDraw; } |
| 101 void setSkipsDraw(bool skipsDraw) { m_skipsDraw = skipsDraw; } |
| 102 |
| 103 void clearLayerList() { m_layerList.clear(); } |
| 104 Vector<RefPtr<LayerChromium> >& layerList() { return m_layerList; } |
| 105 |
| 106 void setMaskLayer(LayerChromium* maskLayer) { m_maskLayer = maskLayer; } |
| 107 |
| 108 void setNearestAncestorThatMovesPixels(RenderSurfaceChromium* surface) { m_n
earestAncestorThatMovesPixels = surface; } |
| 109 const RenderSurfaceChromium* nearestAncestorThatMovesPixels() const { return
m_nearestAncestorThatMovesPixels; } |
| 110 |
| 111 RenderSurfaceChromium* targetRenderSurface() const; |
| 112 |
| 113 bool hasReplica() const; |
| 114 |
| 115 bool hasMask() const; |
| 116 bool replicaHasMask() const; |
| 117 |
| 118 FloatRect computeRootScissorRectInCurrentSurface(const FloatRect& rootScisso
rRect) const; |
| 119 private: |
| 120 LayerChromium* m_owningLayer; |
| 121 LayerChromium* m_maskLayer; |
| 122 |
| 123 // Uses this surface's space. |
| 124 IntRect m_contentRect; |
| 125 bool m_skipsDraw; |
| 126 |
| 127 float m_drawOpacity; |
| 128 bool m_drawOpacityIsAnimating; |
| 129 WebKit::WebTransformationMatrix m_drawTransform; |
| 130 WebKit::WebTransformationMatrix m_originTransform; |
| 131 WebKit::WebTransformationMatrix m_screenSpaceTransform; |
| 132 WebKit::WebTransformationMatrix m_replicaDrawTransform; |
| 133 WebKit::WebTransformationMatrix m_replicaOriginTransform; |
| 134 WebKit::WebTransformationMatrix m_replicaScreenSpaceTransform; |
| 135 bool m_targetSurfaceTransformsAreAnimating; |
| 136 bool m_screenSpaceTransformsAreAnimating; |
| 137 WebKit::WebFilterOperations m_filters; |
| 138 WebKit::WebFilterOperations m_backgroundFilters; |
| 139 |
| 140 // Uses the space of the surface's target surface. |
| 141 IntRect m_clipRect; |
| 142 |
| 143 // During drawing, identifies the region outside of which nothing should be
drawn. |
| 144 // Currently this is set to layer's clipRect if usesLayerClipping is true, o
therwise |
| 145 // it's targetRenderSurface's contentRect. |
| 146 // Uses the space of the surface's target surface. |
| 147 IntRect m_scissorRect; |
| 148 |
| 149 Vector<RefPtr<LayerChromium> > m_layerList; |
| 150 |
| 151 // The nearest ancestor target surface that will contain the contents of thi
s surface, and that is going |
| 152 // to move pixels within the surface (such as with a blur). This can point t
o itself. |
| 153 RenderSurfaceChromium* m_nearestAncestorThatMovesPixels; |
| 154 |
| 155 // For CCLayerIteratorActions |
| 156 int m_targetRenderSurfaceLayerIndexHistory; |
| 157 int m_currentLayerIndexHistory; |
| 158 friend struct CCLayerIteratorActions; |
| 159 }; |
| 160 |
| 161 } |
| 162 #endif // USE(ACCELERATED_COMPOSITING) |
| 163 |
| 164 #endif |
OLD | NEW |