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 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #if USE(ACCELERATED_COMPOSITING) | 7 #if USE(ACCELERATED_COMPOSITING) |
8 | 8 |
9 #include "CCRenderSurface.h" | 9 #include "CCRenderSurface.h" |
10 | 10 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 162 |
163 void CCRenderSurface::appendRenderPasses(CCRenderPassSink& passSink) | 163 void CCRenderSurface::appendRenderPasses(CCRenderPassSink& passSink) |
164 { | 164 { |
165 OwnPtr<CCRenderPass> pass = CCRenderPass::create(m_owningLayer->id(), m_cont
entRect, m_screenSpaceTransform); | 165 OwnPtr<CCRenderPass> pass = CCRenderPass::create(m_owningLayer->id(), m_cont
entRect, m_screenSpaceTransform); |
166 pass->setDamageRect(m_damageTracker->currentDamageRect()); | 166 pass->setDamageRect(m_damageTracker->currentDamageRect()); |
167 pass->setFilters(m_owningLayer->filters()); | 167 pass->setFilters(m_owningLayer->filters()); |
168 pass->setBackgroundFilters(m_owningLayer->backgroundFilters()); | 168 pass->setBackgroundFilters(m_owningLayer->backgroundFilters()); |
169 passSink.appendRenderPass(pass.release()); | 169 passSink.appendRenderPass(pass.release()); |
170 } | 170 } |
171 | 171 |
172 void CCRenderSurface::appendQuads(CCQuadSink& quadSink, bool forReplica, int ren
derPassId) | 172 void CCRenderSurface::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appen
dQuadsData, bool forReplica, int renderPassId) |
173 { | 173 { |
174 ASSERT(!forReplica || m_owningLayer->hasReplica()); | 174 ASSERT(!forReplica || m_owningLayer->hasReplica()); |
175 | 175 |
176 IntRect clippedRectInTarget = computeClippedRectInTarget(m_owningLayer); | 176 IntRect clippedRectInTarget = computeClippedRectInTarget(m_owningLayer); |
177 bool isOpaque = false; | 177 bool isOpaque = false; |
178 const WebTransformationMatrix& drawTransform = forReplica ? m_replicaDrawTra
nsform : m_drawTransform; | 178 const WebTransformationMatrix& drawTransform = forReplica ? m_replicaDrawTra
nsform : m_drawTransform; |
179 CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(CCSharedQua
dState::create(drawTransform, m_contentRect, clippedRectInTarget, m_drawOpacity,
isOpaque)); | 179 CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(CCSharedQua
dState::create(drawTransform, m_contentRect, clippedRectInTarget, m_drawOpacity,
isOpaque)); |
180 | 180 |
181 if (m_owningLayer->hasDebugBorders()) { | 181 if (m_owningLayer->hasDebugBorders()) { |
182 int red = forReplica ? debugReplicaBorderColorRed : debugSurfaceBorderCo
lorRed; | 182 int red = forReplica ? debugReplicaBorderColorRed : debugSurfaceBorderCo
lorRed; |
183 int green = forReplica ? debugReplicaBorderColorGreen : debugSurfaceBor
derColorGreen; | 183 int green = forReplica ? debugReplicaBorderColorGreen : debugSurfaceBor
derColorGreen; |
184 int blue = forReplica ? debugReplicaBorderColorBlue : debugSurfaceBorder
ColorBlue; | 184 int blue = forReplica ? debugReplicaBorderColorBlue : debugSurfaceBorder
ColorBlue; |
185 SkColor color = SkColorSetARGB(debugSurfaceBorderAlpha, red, green, blue
); | 185 SkColor color = SkColorSetARGB(debugSurfaceBorderAlpha, red, green, blue
); |
186 quadSink.append(CCDebugBorderDrawQuad::create(sharedQuadState, contentRe
ct(), color, debugSurfaceBorderWidth)); | 186 quadSink.append(CCDebugBorderDrawQuad::create(sharedQuadState, contentRe
ct(), color, debugSurfaceBorderWidth), appendQuadsData); |
187 } | 187 } |
188 | 188 |
189 // FIXME: By using the same RenderSurface for both the content and its refle
ction, | 189 // FIXME: By using the same RenderSurface for both the content and its refle
ction, |
190 // it's currently not possible to apply a separate mask to the reflection la
yer | 190 // it's currently not possible to apply a separate mask to the reflection la
yer |
191 // or correctly handle opacity in reflections (opacity must be applied after
drawing | 191 // or correctly handle opacity in reflections (opacity must be applied after
drawing |
192 // both the layer and its reflection). The solution is to introduce yet anot
her RenderSurface | 192 // both the layer and its reflection). The solution is to introduce yet anot
her RenderSurface |
193 // to draw the layer and its reflection in. For now we only apply a separate
reflection | 193 // to draw the layer and its reflection in. For now we only apply a separate
reflection |
194 // mask if the contents don't have a mask of their own. | 194 // mask if the contents don't have a mask of their own. |
195 CCLayerImpl* maskLayer = m_owningLayer->maskLayer(); | 195 CCLayerImpl* maskLayer = m_owningLayer->maskLayer(); |
196 if (maskLayer && (!maskLayer->drawsContent() || maskLayer->bounds().isEmpty(
))) | 196 if (maskLayer && (!maskLayer->drawsContent() || maskLayer->bounds().isEmpty(
))) |
(...skipping 13 matching lines...) Expand all Loading... |
210 maskTexCoordScaleX = static_cast<float>(contentRect().width()) / maskLay
er->contentBounds().width(); | 210 maskTexCoordScaleX = static_cast<float>(contentRect().width()) / maskLay
er->contentBounds().width(); |
211 maskTexCoordScaleY = static_cast<float>(contentRect().height()) / maskLa
yer->contentBounds().height(); | 211 maskTexCoordScaleY = static_cast<float>(contentRect().height()) / maskLa
yer->contentBounds().height(); |
212 maskTexCoordOffsetX = static_cast<float>(contentRect().x()) / contentRec
t().width() * maskTexCoordScaleX; | 212 maskTexCoordOffsetX = static_cast<float>(contentRect().x()) / contentRec
t().width() * maskTexCoordScaleX; |
213 maskTexCoordOffsetY = static_cast<float>(contentRect().y()) / contentRec
t().height() * maskTexCoordScaleY; | 213 maskTexCoordOffsetY = static_cast<float>(contentRect().y()) / contentRec
t().height() * maskTexCoordScaleY; |
214 } | 214 } |
215 | 215 |
216 CCResourceProvider::ResourceId maskResourceId = maskLayer ? maskLayer->conte
ntsResourceId() : 0; | 216 CCResourceProvider::ResourceId maskResourceId = maskLayer ? maskLayer->conte
ntsResourceId() : 0; |
217 IntRect contentsChangedSinceLastFrame = contentsChanged() ? m_contentRect :
IntRect(); | 217 IntRect contentsChangedSinceLastFrame = contentsChanged() ? m_contentRect :
IntRect(); |
218 | 218 |
219 quadSink.append(CCRenderPassDrawQuad::create(sharedQuadState, contentRect(),
renderPassId, forReplica, maskResourceId, contentsChangedSinceLastFrame, | 219 quadSink.append(CCRenderPassDrawQuad::create(sharedQuadState, contentRect(),
renderPassId, forReplica, maskResourceId, contentsChangedSinceLastFrame, |
220 maskTexCoordScaleX, maskTexCoor
dScaleY, maskTexCoordOffsetX, maskTexCoordOffsetY)); | 220 maskTexCoordScaleX, maskTexCoor
dScaleY, maskTexCoordOffsetX, maskTexCoordOffsetY), appendQuadsData); |
221 } | 221 } |
222 | 222 |
223 } | 223 } |
224 #endif // USE(ACCELERATED_COMPOSITING) | 224 #endif // USE(ACCELERATED_COMPOSITING) |
OLD | NEW |