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 "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 "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 initializeMatrices(frame, renderPass->output_rect, flippedFramebuffer())
; | 270 initializeMatrices(frame, renderPass->output_rect, flippedFramebuffer())
; |
271 setDrawViewportSize(renderPass->output_rect.size()); | 271 setDrawViewportSize(renderPass->output_rect.size()); |
272 return true; | 272 return true; |
273 } | 273 } |
274 | 274 |
275 CachedResource* texture = m_renderPassTextures.get(renderPass->id); | 275 CachedResource* texture = m_renderPassTextures.get(renderPass->id); |
276 DCHECK(texture); | 276 DCHECK(texture); |
277 | 277 |
278 gfx::Size size = renderPassTextureSize(renderPass); | 278 gfx::Size size = renderPassTextureSize(renderPass); |
279 size.Enlarge(m_enlargePassTextureAmount.x(), m_enlargePassTextureAmount.y())
; | 279 size.Enlarge(m_enlargePassTextureAmount.x(), m_enlargePassTextureAmount.y())
; |
280 if (!texture->id() && !texture->Allocate(Renderer::ImplPool, size, renderPas
sTextureFormat(renderPass), ResourceProvider::TextureUsageFramebuffer)) | 280 if (!texture->id() && !texture->Allocate(size, renderPassTextureFormat(rende
rPass), ResourceProvider::TextureUsageFramebuffer)) |
281 return false; | 281 return false; |
282 | 282 |
283 return bindFramebufferToTexture(frame, texture, renderPass->output_rect); | 283 return bindFramebufferToTexture(frame, texture, renderPass->output_rect); |
284 } | 284 } |
285 | 285 |
286 bool DirectRenderer::haveCachedResourcesForRenderPassId(RenderPass::Id id) const | 286 bool DirectRenderer::haveCachedResourcesForRenderPassId(RenderPass::Id id) const |
287 { | 287 { |
288 CachedResource* texture = m_renderPassTextures.get(id); | 288 CachedResource* texture = m_renderPassTextures.get(id); |
289 return texture && texture->id() && texture->isComplete(); | 289 return texture && texture->id() && texture->isComplete(); |
290 } | 290 } |
291 | 291 |
292 // static | 292 // static |
293 gfx::Size DirectRenderer::renderPassTextureSize(const RenderPass* pass) | 293 gfx::Size DirectRenderer::renderPassTextureSize(const RenderPass* pass) |
294 { | 294 { |
295 return pass->output_rect.size(); | 295 return pass->output_rect.size(); |
296 } | 296 } |
297 | 297 |
298 // static | 298 // static |
299 GLenum DirectRenderer::renderPassTextureFormat(const RenderPass*) | 299 GLenum DirectRenderer::renderPassTextureFormat(const RenderPass*) |
300 { | 300 { |
301 return GL_RGBA; | 301 return GL_RGBA; |
302 } | 302 } |
303 | 303 |
304 } // namespace cc | 304 } // namespace cc |
OLD | NEW |