Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Side by Side Diff: cc/direct_renderer.cc

Issue 11412022: Switched cc::Resource and cc::ScopedResource to Chrome coding style. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed unit tests. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | cc/gl_renderer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "cc/direct_renderer.h" 5 #include "cc/direct_renderer.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "cc/math_util.h" 10 #include "cc/math_util.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 continue; 129 continue;
130 } 130 }
131 131
132 const RenderPass* renderPassInFrame = it->second; 132 const RenderPass* renderPassInFrame = it->second;
133 const gfx::Size& requiredSize = renderPassTextureSize(renderPassInFrame) ; 133 const gfx::Size& requiredSize = renderPassTextureSize(renderPassInFrame) ;
134 GLenum requiredFormat = renderPassTextureFormat(renderPassInFrame); 134 GLenum requiredFormat = renderPassTextureFormat(renderPassInFrame);
135 CachedResource* texture = passIterator->second; 135 CachedResource* texture = passIterator->second;
136 DCHECK(texture); 136 DCHECK(texture);
137 137
138 if (texture->id() && (texture->size() != requiredSize || texture->format () != requiredFormat)) 138 if (texture->id() && (texture->size() != requiredSize || texture->format () != requiredFormat))
139 texture->free(); 139 texture->Free();
140 } 140 }
141 141
142 // Delete RenderPass textures from the previous frame that will not be used again. 142 // Delete RenderPass textures from the previous frame that will not be used again.
143 for (size_t i = 0; i < passesToDelete.size(); ++i) 143 for (size_t i = 0; i < passesToDelete.size(); ++i)
144 m_renderPassTextures.erase(passesToDelete[i]); 144 m_renderPassTextures.erase(passesToDelete[i]);
145 145
146 for (size_t i = 0; i < renderPassesInDrawOrder.size(); ++i) { 146 for (size_t i = 0; i < renderPassesInDrawOrder.size(); ++i) {
147 if (!m_renderPassTextures.contains(renderPassesInDrawOrder[i]->id())) { 147 if (!m_renderPassTextures.contains(renderPassesInDrawOrder[i]->id())) {
148 scoped_ptr<CachedResource> texture = CachedResource::create(m_resource Provider); 148 scoped_ptr<CachedResource> texture = CachedResource::create(m_resource Provider);
149 m_renderPassTextures.set(renderPassesInDrawOrder[i]->id(), texture.P ass()); 149 m_renderPassTextures.set(renderPassesInDrawOrder[i]->id(), texture.P ass());
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 206
207 if (renderPass == frame.rootRenderPass) { 207 if (renderPass == frame.rootRenderPass) {
208 bindFramebufferToOutputSurface(frame); 208 bindFramebufferToOutputSurface(frame);
209 initializeMatrices(frame, renderPass->outputRect(), flippedFramebuffer() ); 209 initializeMatrices(frame, renderPass->outputRect(), flippedFramebuffer() );
210 setDrawViewportSize(renderPass->outputRect().size()); 210 setDrawViewportSize(renderPass->outputRect().size());
211 return true; 211 return true;
212 } 212 }
213 213
214 CachedResource* texture = m_renderPassTextures.get(renderPass->id()); 214 CachedResource* texture = m_renderPassTextures.get(renderPass->id());
215 DCHECK(texture); 215 DCHECK(texture);
216 if (!texture->id() && !texture->allocate(Renderer::ImplPool, renderPassTextu reSize(renderPass), renderPassTextureFormat(renderPass), ResourceProvider::Textu reUsageFramebuffer)) 216 if (!texture->id() && !texture->Allocate(Renderer::ImplPool, renderPassTextu reSize(renderPass), renderPassTextureFormat(renderPass), ResourceProvider::Textu reUsageFramebuffer))
217 return false; 217 return false;
218 218
219 return bindFramebufferToTexture(frame, texture, renderPass->outputRect()); 219 return bindFramebufferToTexture(frame, texture, renderPass->outputRect());
220 } 220 }
221 221
222 bool DirectRenderer::haveCachedResourcesForRenderPassId(RenderPass::Id id) const 222 bool DirectRenderer::haveCachedResourcesForRenderPassId(RenderPass::Id id) const
223 { 223 {
224 CachedResource* texture = m_renderPassTextures.get(id); 224 CachedResource* texture = m_renderPassTextures.get(id);
225 return texture && texture->id() && texture->isComplete(); 225 return texture && texture->id() && texture->isComplete();
226 } 226 }
227 227
228 // static 228 // static
229 gfx::Size DirectRenderer::renderPassTextureSize(const RenderPass* pass) 229 gfx::Size DirectRenderer::renderPassTextureSize(const RenderPass* pass)
230 { 230 {
231 return pass->outputRect().size(); 231 return pass->outputRect().size();
232 } 232 }
233 233
234 // static 234 // static
235 GLenum DirectRenderer::renderPassTextureFormat(const RenderPass*) 235 GLenum DirectRenderer::renderPassTextureFormat(const RenderPass*)
236 { 236 {
237 return GL_RGBA; 237 return GL_RGBA;
238 } 238 }
239 239
240 } // namespace cc 240 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/gl_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698