| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 #include "CCDirectRenderer.h" | 7 #include "CCDirectRenderer.h" |
| 8 | 8 |
| 9 #include "CCMathUtil.h" | 9 #include "CCMathUtil.h" |
| 10 #include <public/WebTransformationMatrix.h> | 10 #include <public/WebTransformationMatrix.h> |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 scissorRectInCanvasSpace.setX(scissorRectInCanvasSpace.x() - framebufferOutp
utRect.x()); | 84 scissorRectInCanvasSpace.setX(scissorRectInCanvasSpace.x() - framebufferOutp
utRect.x()); |
| 85 if (frame.flippedY && !frame.currentTexture) | 85 if (frame.flippedY && !frame.currentTexture) |
| 86 scissorRectInCanvasSpace.setY(framebufferOutputRect.height() - (scissorR
ectInCanvasSpace.maxY() - framebufferOutputRect.y())); | 86 scissorRectInCanvasSpace.setY(framebufferOutputRect.height() - (scissorR
ectInCanvasSpace.maxY() - framebufferOutputRect.y())); |
| 87 else | 87 else |
| 88 scissorRectInCanvasSpace.setY(scissorRectInCanvasSpace.y() - framebuffer
OutputRect.y()); | 88 scissorRectInCanvasSpace.setY(scissorRectInCanvasSpace.y() - framebuffer
OutputRect.y()); |
| 89 return scissorRectInCanvasSpace; | 89 return scissorRectInCanvasSpace; |
| 90 } | 90 } |
| 91 | 91 |
| 92 void CCDirectRenderer::decideRenderPassAllocationsForFrame(const CCRenderPassLis
t& renderPassesInDrawOrder) | 92 void CCDirectRenderer::decideRenderPassAllocationsForFrame(const CCRenderPassLis
t& renderPassesInDrawOrder) |
| 93 { | 93 { |
| 94 HashMap<int, const CCRenderPass*> renderPassesInFrame; | 94 HashMap<CCRenderPass::Id, const CCRenderPass*> renderPassesInFrame; |
| 95 for (size_t i = 0; i < renderPassesInDrawOrder.size(); ++i) | 95 for (size_t i = 0; i < renderPassesInDrawOrder.size(); ++i) |
| 96 renderPassesInFrame.set(renderPassesInDrawOrder[i]->id(), renderPassesIn
DrawOrder[i]); | 96 renderPassesInFrame.set(renderPassesInDrawOrder[i]->id(), renderPassesIn
DrawOrder[i]); |
| 97 | 97 |
| 98 Vector<int> passesToDelete; | 98 Vector<CCRenderPass::Id> passesToDelete; |
| 99 HashMap<int, OwnPtr<CachedTexture> >::const_iterator passIterator; | 99 HashMap<CCRenderPass::Id, OwnPtr<CachedTexture> >::const_iterator passIterat
or; |
| 100 for (passIterator = m_renderPassTextures.begin(); passIterator != m_renderPa
ssTextures.end(); ++passIterator) { | 100 for (passIterator = m_renderPassTextures.begin(); passIterator != m_renderPa
ssTextures.end(); ++passIterator) { |
| 101 const CCRenderPass* renderPassInFrame = renderPassesInFrame.get(passIter
ator->first); | 101 const CCRenderPass* renderPassInFrame = renderPassesInFrame.get(passIter
ator->first); |
| 102 if (!renderPassInFrame) { | 102 if (!renderPassInFrame) { |
| 103 passesToDelete.append(passIterator->first); | 103 passesToDelete.append(passIterator->first); |
| 104 continue; | 104 continue; |
| 105 } | 105 } |
| 106 | 106 |
| 107 const IntSize& requiredSize = renderPassTextureSize(renderPassInFrame); | 107 const IntSize& requiredSize = renderPassTextureSize(renderPassInFrame); |
| 108 GC3Denum requiredFormat = renderPassTextureFormat(renderPassInFrame); | 108 GC3Denum requiredFormat = renderPassTextureFormat(renderPassInFrame); |
| 109 CachedTexture* texture = passIterator->second.get(); | 109 CachedTexture* texture = passIterator->second.get(); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 } | 184 } |
| 185 | 185 |
| 186 CachedTexture* texture = m_renderPassTextures.get(renderPass->id()); | 186 CachedTexture* texture = m_renderPassTextures.get(renderPass->id()); |
| 187 ASSERT(texture); | 187 ASSERT(texture); |
| 188 if (!texture->id() && !texture->allocate(CCRenderer::ImplPool, renderPassTex
tureSize(renderPass), renderPassTextureFormat(renderPass), CCResourceProvider::T
extureUsageFramebuffer)) | 188 if (!texture->id() && !texture->allocate(CCRenderer::ImplPool, renderPassTex
tureSize(renderPass), renderPassTextureFormat(renderPass), CCResourceProvider::T
extureUsageFramebuffer)) |
| 189 return false; | 189 return false; |
| 190 | 190 |
| 191 return bindFramebufferToTexture(frame, texture, renderPass->outputRect()); | 191 return bindFramebufferToTexture(frame, texture, renderPass->outputRect()); |
| 192 } | 192 } |
| 193 | 193 |
| 194 bool CCDirectRenderer::haveCachedResourcesForRenderPassId(int id) const | 194 bool CCDirectRenderer::haveCachedResourcesForRenderPassId(CCRenderPass::Id id) c
onst |
| 195 { | 195 { |
| 196 CachedTexture* texture = m_renderPassTextures.get(id); | 196 CachedTexture* texture = m_renderPassTextures.get(id); |
| 197 return texture && texture->id() && texture->isComplete(); | 197 return texture && texture->id() && texture->isComplete(); |
| 198 } | 198 } |
| 199 | 199 |
| 200 // static | 200 // static |
| 201 IntSize CCDirectRenderer::renderPassTextureSize(const CCRenderPass* pass) | 201 IntSize CCDirectRenderer::renderPassTextureSize(const CCRenderPass* pass) |
| 202 { | 202 { |
| 203 return pass->outputRect().size(); | 203 return pass->outputRect().size(); |
| 204 } | 204 } |
| 205 | 205 |
| 206 // static | 206 // static |
| 207 GC3Denum CCDirectRenderer::renderPassTextureFormat(const CCRenderPass*) | 207 GC3Denum CCDirectRenderer::renderPassTextureFormat(const CCRenderPass*) |
| 208 { | 208 { |
| 209 return GraphicsContext3D::RGBA; | 209 return GraphicsContext3D::RGBA; |
| 210 } | 210 } |
| 211 | 211 |
| 212 } | 212 } |
| OLD | NEW |