| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <unordered_map> | 9 #include <unordered_map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 | 545 |
| 546 ScopedResource* texture = render_pass_textures_[render_pass->id].get(); | 546 ScopedResource* texture = render_pass_textures_[render_pass->id].get(); |
| 547 DCHECK(texture); | 547 DCHECK(texture); |
| 548 | 548 |
| 549 gfx::Size size = RenderPassTextureSize(render_pass); | 549 gfx::Size size = RenderPassTextureSize(render_pass); |
| 550 size.Enlarge(enlarge_pass_texture_amount_.width(), | 550 size.Enlarge(enlarge_pass_texture_amount_.width(), |
| 551 enlarge_pass_texture_amount_.height()); | 551 enlarge_pass_texture_amount_.height()); |
| 552 if (!texture->id()) { | 552 if (!texture->id()) { |
| 553 texture->Allocate(size, | 553 texture->Allocate(size, |
| 554 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, | 554 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, |
| 555 resource_provider_->best_texture_format()); | 555 resource_provider_->best_texture_format(), |
| 556 output_surface_->device_color_space()); |
| 556 } | 557 } |
| 557 DCHECK(texture->id()); | 558 DCHECK(texture->id()); |
| 558 | 559 |
| 559 if (BindFramebufferToTexture(frame, texture)) { | 560 if (BindFramebufferToTexture(frame, texture)) { |
| 560 InitializeViewport(frame, render_pass->output_rect, | 561 InitializeViewport(frame, render_pass->output_rect, |
| 561 gfx::Rect(render_pass->output_rect.size()), | 562 gfx::Rect(render_pass->output_rect.size()), |
| 562 texture->size()); | 563 texture->size()); |
| 563 return true; | 564 return true; |
| 564 } | 565 } |
| 565 | 566 |
| 566 return false; | 567 return false; |
| 567 } | 568 } |
| 568 | 569 |
| 569 bool DirectRenderer::HasAllocatedResourcesForTesting(RenderPassId id) const { | 570 bool DirectRenderer::HasAllocatedResourcesForTesting(RenderPassId id) const { |
| 570 auto iter = render_pass_textures_.find(id); | 571 auto iter = render_pass_textures_.find(id); |
| 571 return iter != render_pass_textures_.end() && iter->second->id(); | 572 return iter != render_pass_textures_.end() && iter->second->id(); |
| 572 } | 573 } |
| 573 | 574 |
| 574 // static | 575 // static |
| 575 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { | 576 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { |
| 576 return render_pass->output_rect.size(); | 577 return render_pass->output_rect.size(); |
| 577 } | 578 } |
| 578 | 579 |
| 579 } // namespace cc | 580 } // namespace cc |
| OLD | NEW |