Chromium Code Reviews| 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 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 602 return true; | 602 return true; |
| 603 } | 603 } |
| 604 | 604 |
| 605 ScopedResource* texture = render_pass_textures_[render_pass->id].get(); | 605 ScopedResource* texture = render_pass_textures_[render_pass->id].get(); |
| 606 DCHECK(texture); | 606 DCHECK(texture); |
| 607 | 607 |
| 608 gfx::Size size = RenderPassTextureSize(render_pass); | 608 gfx::Size size = RenderPassTextureSize(render_pass); |
| 609 size.Enlarge(enlarge_pass_texture_amount_.width(), | 609 size.Enlarge(enlarge_pass_texture_amount_.width(), |
| 610 enlarge_pass_texture_amount_.height()); | 610 enlarge_pass_texture_amount_.height()); |
| 611 if (!texture->id()) { | 611 if (!texture->id()) { |
| 612 texture->Allocate( | 612 texture->Allocate(size, |
|
jbauman
2017/02/01 23:59:21
Is it expected that BackbufferFormat could change
| |
| 613 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, | 613 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, |
| 614 resource_provider_->best_texture_format(), frame->device_color_space); | 614 BackbufferFormat(), frame->device_color_space); |
| 615 } | 615 } |
| 616 DCHECK(texture->id()); | 616 DCHECK(texture->id()); |
| 617 | 617 |
| 618 if (BindFramebufferToTexture(frame, texture)) { | 618 if (BindFramebufferToTexture(frame, texture)) { |
| 619 InitializeViewport(frame, render_pass->output_rect, | 619 InitializeViewport(frame, render_pass->output_rect, |
| 620 gfx::Rect(render_pass->output_rect.size()), | 620 gfx::Rect(render_pass->output_rect.size()), |
| 621 texture->size()); | 621 texture->size()); |
| 622 return true; | 622 return true; |
| 623 } | 623 } |
| 624 | 624 |
| 625 return false; | 625 return false; |
| 626 } | 626 } |
| 627 | 627 |
| 628 bool DirectRenderer::HasAllocatedResourcesForTesting(int render_pass_id) const { | 628 bool DirectRenderer::HasAllocatedResourcesForTesting(int render_pass_id) const { |
| 629 auto iter = render_pass_textures_.find(render_pass_id); | 629 auto iter = render_pass_textures_.find(render_pass_id); |
| 630 return iter != render_pass_textures_.end() && iter->second->id(); | 630 return iter != render_pass_textures_.end() && iter->second->id(); |
| 631 } | 631 } |
| 632 | 632 |
| 633 // static | 633 // static |
| 634 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { | 634 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { |
| 635 return render_pass->output_rect.size(); | 635 return render_pass->output_rect.size(); |
| 636 } | 636 } |
| 637 | 637 |
| 638 } // namespace cc | 638 } // namespace cc |
| OLD | NEW |