| 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/output/direct_renderer.h" | 5 #include "cc/output/direct_renderer.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 | 392 |
| 393 CachedResource* texture = render_pass_textures_.get(render_pass->id); | 393 CachedResource* texture = render_pass_textures_.get(render_pass->id); |
| 394 DCHECK(texture); | 394 DCHECK(texture); |
| 395 | 395 |
| 396 gfx::Size size = RenderPassTextureSize(render_pass); | 396 gfx::Size size = RenderPassTextureSize(render_pass); |
| 397 size.Enlarge(enlarge_pass_texture_amount_.x(), | 397 size.Enlarge(enlarge_pass_texture_amount_.x(), |
| 398 enlarge_pass_texture_amount_.y()); | 398 enlarge_pass_texture_amount_.y()); |
| 399 if (!texture->id() && | 399 if (!texture->id() && |
| 400 !texture->Allocate(size, | 400 !texture->Allocate(size, |
| 401 RenderPassTextureFormat(render_pass), | 401 RenderPassTextureFormat(render_pass), |
| 402 ResourceProvider::TextureUsageFramebuffer)) | 402 ResourceProvider::TextureUsageFramebuffer, |
| 403 RenderPassTextureType(render_pass))) |
| 403 return false; | 404 return false; |
| 404 | 405 |
| 405 return BindFramebufferToTexture(frame, texture, render_pass->output_rect); | 406 return BindFramebufferToTexture(frame, texture, render_pass->output_rect); |
| 406 } | 407 } |
| 407 | 408 |
| 408 bool DirectRenderer::HaveCachedResourcesForRenderPassId(RenderPass::Id id) | 409 bool DirectRenderer::HaveCachedResourcesForRenderPassId(RenderPass::Id id) |
| 409 const { | 410 const { |
| 410 if (!settings_->cache_render_pass_contents) | 411 if (!settings_->cache_render_pass_contents) |
| 411 return false; | 412 return false; |
| 412 | 413 |
| 413 CachedResource* texture = render_pass_textures_.get(id); | 414 CachedResource* texture = render_pass_textures_.get(id); |
| 414 return texture && texture->id() && texture->is_complete(); | 415 return texture && texture->id() && texture->is_complete(); |
| 415 } | 416 } |
| 416 | 417 |
| 417 // static | 418 // static |
| 418 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { | 419 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { |
| 419 return render_pass->output_rect.size(); | 420 return render_pass->output_rect.size(); |
| 420 } | 421 } |
| 421 | 422 |
| 422 // static | 423 // static |
| 423 GLenum DirectRenderer::RenderPassTextureFormat(const RenderPass* render_pass) { | 424 GLenum DirectRenderer::RenderPassTextureFormat(const RenderPass* render_pass) { |
| 424 return GL_RGBA; | 425 return GL_RGBA; |
| 425 } | 426 } |
| 426 | 427 |
| 428 // static |
| 429 ResourceProvider::TextureType DirectRenderer::RenderPassTextureType( |
| 430 const RenderPass* render_pass) { |
| 431 return ResourceProvider::RGBA_8888; |
| 432 } |
| 433 |
| 427 } // namespace cc | 434 } // namespace cc |
| OLD | NEW |