| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 passSink.appendRenderPass(pass.Pass()); | 198 passSink.appendRenderPass(pass.Pass()); |
| 199 } | 199 } |
| 200 | 200 |
| 201 void CCRenderSurface::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appen
dQuadsData, bool forReplica, CCRenderPass::Id renderPassId) | 201 void CCRenderSurface::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appen
dQuadsData, bool forReplica, CCRenderPass::Id renderPassId) |
| 202 { | 202 { |
| 203 ASSERT(!forReplica || m_owningLayer->hasReplica()); | 203 ASSERT(!forReplica || m_owningLayer->hasReplica()); |
| 204 | 204 |
| 205 IntRect clippedRectInTarget = computeClippedRectInTarget(m_owningLayer); | 205 IntRect clippedRectInTarget = computeClippedRectInTarget(m_owningLayer); |
| 206 bool isOpaque = false; | 206 bool isOpaque = false; |
| 207 const WebTransformationMatrix& drawTransform = forReplica ? m_replicaDrawTra
nsform : m_drawTransform; | 207 const WebTransformationMatrix& drawTransform = forReplica ? m_replicaDrawTra
nsform : m_drawTransform; |
| 208 CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(CCSharedQua
dState::create(drawTransform, m_contentRect, clippedRectInTarget, m_drawOpacity,
isOpaque)); | 208 CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(CCSharedQua
dState::create(drawTransform, m_contentRect, clippedRectInTarget, m_drawOpacity,
isOpaque).Pass()); |
| 209 | 209 |
| 210 if (m_owningLayer->hasDebugBorders()) { | 210 if (m_owningLayer->hasDebugBorders()) { |
| 211 int red = forReplica ? debugReplicaBorderColorRed : debugSurfaceBorderCo
lorRed; | 211 int red = forReplica ? debugReplicaBorderColorRed : debugSurfaceBorderCo
lorRed; |
| 212 int green = forReplica ? debugReplicaBorderColorGreen : debugSurfaceBor
derColorGreen; | 212 int green = forReplica ? debugReplicaBorderColorGreen : debugSurfaceBor
derColorGreen; |
| 213 int blue = forReplica ? debugReplicaBorderColorBlue : debugSurfaceBorder
ColorBlue; | 213 int blue = forReplica ? debugReplicaBorderColorBlue : debugSurfaceBorder
ColorBlue; |
| 214 SkColor color = SkColorSetARGB(debugSurfaceBorderAlpha, red, green, blue
); | 214 SkColor color = SkColorSetARGB(debugSurfaceBorderAlpha, red, green, blue
); |
| 215 quadSink.append(CCDebugBorderDrawQuad::create(sharedQuadState, contentRe
ct(), color, debugSurfaceBorderWidth), appendQuadsData); | 215 quadSink.append(CCDebugBorderDrawQuad::create(sharedQuadState, contentRe
ct(), color, debugSurfaceBorderWidth).PassAs<CCDrawQuad>(), appendQuadsData); |
| 216 } | 216 } |
| 217 | 217 |
| 218 // FIXME: By using the same RenderSurface for both the content and its refle
ction, | 218 // FIXME: By using the same RenderSurface for both the content and its refle
ction, |
| 219 // it's currently not possible to apply a separate mask to the reflection la
yer | 219 // it's currently not possible to apply a separate mask to the reflection la
yer |
| 220 // or correctly handle opacity in reflections (opacity must be applied after
drawing | 220 // or correctly handle opacity in reflections (opacity must be applied after
drawing |
| 221 // both the layer and its reflection). The solution is to introduce yet anot
her RenderSurface | 221 // both the layer and its reflection). The solution is to introduce yet anot
her RenderSurface |
| 222 // to draw the layer and its reflection in. For now we only apply a separate
reflection | 222 // to draw the layer and its reflection in. For now we only apply a separate
reflection |
| 223 // mask if the contents don't have a mask of their own. | 223 // mask if the contents don't have a mask of their own. |
| 224 CCLayerImpl* maskLayer = m_owningLayer->maskLayer(); | 224 CCLayerImpl* maskLayer = m_owningLayer->maskLayer(); |
| 225 if (maskLayer && (!maskLayer->drawsContent() || maskLayer->bounds().isEmpty(
))) | 225 if (maskLayer && (!maskLayer->drawsContent() || maskLayer->bounds().isEmpty(
))) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 239 maskTexCoordScaleX = static_cast<float>(contentRect().width()) / maskLay
er->contentBounds().width(); | 239 maskTexCoordScaleX = static_cast<float>(contentRect().width()) / maskLay
er->contentBounds().width(); |
| 240 maskTexCoordScaleY = static_cast<float>(contentRect().height()) / maskLa
yer->contentBounds().height(); | 240 maskTexCoordScaleY = static_cast<float>(contentRect().height()) / maskLa
yer->contentBounds().height(); |
| 241 maskTexCoordOffsetX = static_cast<float>(contentRect().x()) / contentRec
t().width() * maskTexCoordScaleX; | 241 maskTexCoordOffsetX = static_cast<float>(contentRect().x()) / contentRec
t().width() * maskTexCoordScaleX; |
| 242 maskTexCoordOffsetY = static_cast<float>(contentRect().y()) / contentRec
t().height() * maskTexCoordScaleY; | 242 maskTexCoordOffsetY = static_cast<float>(contentRect().y()) / contentRec
t().height() * maskTexCoordScaleY; |
| 243 } | 243 } |
| 244 | 244 |
| 245 CCResourceProvider::ResourceId maskResourceId = maskLayer ? maskLayer->conte
ntsResourceId() : 0; | 245 CCResourceProvider::ResourceId maskResourceId = maskLayer ? maskLayer->conte
ntsResourceId() : 0; |
| 246 IntRect contentsChangedSinceLastFrame = contentsChanged() ? m_contentRect :
IntRect(); | 246 IntRect contentsChangedSinceLastFrame = contentsChanged() ? m_contentRect :
IntRect(); |
| 247 | 247 |
| 248 quadSink.append(CCRenderPassDrawQuad::create(sharedQuadState, contentRect(),
renderPassId, forReplica, maskResourceId, contentsChangedSinceLastFrame, | 248 quadSink.append(CCRenderPassDrawQuad::create(sharedQuadState, contentRect(),
renderPassId, forReplica, maskResourceId, contentsChangedSinceLastFrame, |
| 249 maskTexCoordScaleX, maskTexCoor
dScaleY, maskTexCoordOffsetX, maskTexCoordOffsetY), appendQuadsData); | 249 maskTexCoordScaleX, maskTexCoor
dScaleY, maskTexCoordOffsetX, maskTexCoordOffsetY).PassAs<CCDrawQuad>(), appendQ
uadsData); |
| 250 } | 250 } |
| 251 | 251 |
| 252 } | 252 } |
| 253 #endif // USE(ACCELERATED_COMPOSITING) | 253 #endif // USE(ACCELERATED_COMPOSITING) |
| OLD | NEW |