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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 ScopedPtrHashMap<CCRenderPass::Id, CachedTexture>::const_iterator passIterat
or; | 123 ScopedPtrHashMap<CCRenderPass::Id, CachedTexture>::const_iterator passIterat
or; |
124 for (passIterator = m_renderPassTextures.begin(); passIterator != m_renderPa
ssTextures.end(); ++passIterator) { | 124 for (passIterator = m_renderPassTextures.begin(); passIterator != m_renderPa
ssTextures.end(); ++passIterator) { |
125 base::hash_map<CCRenderPass::Id, const CCRenderPass*>::const_iterator it
= renderPassesInFrame.find(passIterator->first); | 125 base::hash_map<CCRenderPass::Id, const CCRenderPass*>::const_iterator it
= renderPassesInFrame.find(passIterator->first); |
126 if (it == renderPassesInFrame.end()) { | 126 if (it == renderPassesInFrame.end()) { |
127 passesToDelete.push_back(passIterator->first); | 127 passesToDelete.push_back(passIterator->first); |
128 continue; | 128 continue; |
129 } | 129 } |
130 | 130 |
131 const CCRenderPass* renderPassInFrame = it->second; | 131 const CCRenderPass* renderPassInFrame = it->second; |
132 const IntSize& requiredSize = renderPassTextureSize(renderPassInFrame); | 132 const IntSize& requiredSize = renderPassTextureSize(renderPassInFrame); |
133 GC3Denum requiredFormat = renderPassTextureFormat(renderPassInFrame); | 133 GLenum requiredFormat = renderPassTextureFormat(renderPassInFrame); |
134 CachedTexture* texture = passIterator->second; | 134 CachedTexture* texture = passIterator->second; |
135 ASSERT(texture); | 135 ASSERT(texture); |
136 | 136 |
137 if (texture->id() && (texture->size() != requiredSize || texture->format
() != requiredFormat)) | 137 if (texture->id() && (texture->size() != requiredSize || texture->format
() != requiredFormat)) |
138 texture->free(); | 138 texture->free(); |
139 } | 139 } |
140 | 140 |
141 // Delete RenderPass textures from the previous frame that will not be used
again. | 141 // Delete RenderPass textures from the previous frame that will not be used
again. |
142 for (size_t i = 0; i < passesToDelete.size(); ++i) | 142 for (size_t i = 0; i < passesToDelete.size(); ++i) |
143 m_renderPassTextures.erase(passesToDelete[i]); | 143 m_renderPassTextures.erase(passesToDelete[i]); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 return texture && texture->id() && texture->isComplete(); | 222 return texture && texture->id() && texture->isComplete(); |
223 } | 223 } |
224 | 224 |
225 // static | 225 // static |
226 IntSize CCDirectRenderer::renderPassTextureSize(const CCRenderPass* pass) | 226 IntSize CCDirectRenderer::renderPassTextureSize(const CCRenderPass* pass) |
227 { | 227 { |
228 return pass->outputRect().size(); | 228 return pass->outputRect().size(); |
229 } | 229 } |
230 | 230 |
231 // static | 231 // static |
232 GC3Denum CCDirectRenderer::renderPassTextureFormat(const CCRenderPass*) | 232 GLenum CCDirectRenderer::renderPassTextureFormat(const CCRenderPass*) |
233 { | 233 { |
234 return GraphicsContext3D::RGBA; | 234 return GL_RGBA; |
235 } | 235 } |
236 | 236 |
237 } | 237 } |
OLD | NEW |