| 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 <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 gfx::Size size = RenderPassTextureSize(render_pass); | 620 gfx::Size size = RenderPassTextureSize(render_pass); |
| 621 size.Enlarge(enlarge_pass_texture_amount_.width(), | 621 size.Enlarge(enlarge_pass_texture_amount_.width(), |
| 622 enlarge_pass_texture_amount_.height()); | 622 enlarge_pass_texture_amount_.height()); |
| 623 if (!texture->id()) { | 623 if (!texture->id()) { |
| 624 texture->Allocate( | 624 texture->Allocate( |
| 625 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, | 625 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, |
| 626 BackbufferFormat(), current_frame()->current_render_pass->color_space); | 626 BackbufferFormat(), current_frame()->current_render_pass->color_space); |
| 627 } | 627 } |
| 628 DCHECK(texture->id()); | 628 DCHECK(texture->id()); |
| 629 | 629 |
| 630 if (current_frame()->ComputeScissorRectForRenderPass().IsEmpty()) |
| 631 return false; |
| 632 |
| 630 if (BindFramebufferToTexture(texture)) { | 633 if (BindFramebufferToTexture(texture)) { |
| 631 InitializeViewport(current_frame(), render_pass->output_rect, | 634 InitializeViewport(current_frame(), render_pass->output_rect, |
| 632 gfx::Rect(render_pass->output_rect.size()), | 635 gfx::Rect(render_pass->output_rect.size()), |
| 633 texture->size()); | 636 texture->size()); |
| 634 return true; | 637 return true; |
| 635 } | 638 } |
| 636 | 639 |
| 637 return false; | 640 return false; |
| 638 } | 641 } |
| 639 | 642 |
| 640 bool DirectRenderer::HasAllocatedResourcesForTesting(int render_pass_id) const { | 643 bool DirectRenderer::HasAllocatedResourcesForTesting(int render_pass_id) const { |
| 641 auto iter = render_pass_textures_.find(render_pass_id); | 644 auto iter = render_pass_textures_.find(render_pass_id); |
| 642 return iter != render_pass_textures_.end() && iter->second->id(); | 645 return iter != render_pass_textures_.end() && iter->second->id(); |
| 643 } | 646 } |
| 644 | 647 |
| 645 // static | 648 // static |
| 646 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { | 649 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { |
| 647 return render_pass->output_rect.size(); | 650 return render_pass->output_rect.size(); |
| 648 } | 651 } |
| 649 | 652 |
| 650 void DirectRenderer::SetCurrentFrameForTesting(const DrawingFrame& frame) { | 653 void DirectRenderer::SetCurrentFrameForTesting(const DrawingFrame& frame) { |
| 651 current_frame_valid_ = true; | 654 current_frame_valid_ = true; |
| 652 current_frame_ = frame; | 655 current_frame_ = frame; |
| 653 } | 656 } |
| 654 | 657 |
| 655 } // namespace cc | 658 } // namespace cc |
| OLD | NEW |