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 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
611 ScopedResource* texture = render_pass_textures_[render_pass->id].get(); | 611 ScopedResource* texture = render_pass_textures_[render_pass->id].get(); |
612 DCHECK(texture); | 612 DCHECK(texture); |
613 | 613 |
614 gfx::Size size = RenderPassTextureSize(render_pass); | 614 gfx::Size size = RenderPassTextureSize(render_pass); |
615 size.Enlarge(enlarge_pass_texture_amount_.width(), | 615 size.Enlarge(enlarge_pass_texture_amount_.width(), |
616 enlarge_pass_texture_amount_.height()); | 616 enlarge_pass_texture_amount_.height()); |
617 if (!texture->id()) { | 617 if (!texture->id()) { |
618 texture->Allocate( | 618 texture->Allocate( |
619 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, | 619 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, |
620 BackbufferFormat(), current_frame()->current_render_pass->color_space); | 620 BackbufferFormat(), current_frame()->current_render_pass->color_space); |
621 } else { | |
622 if (render_pass->force_render_surface) | |
reveman
2017/05/10 13:06:17
I'm not sure we can do this without also checking
wutao
2017/05/11 19:36:34
Tested in some animation and the render_pass->dama
| |
623 return false; | |
621 } | 624 } |
622 DCHECK(texture->id()); | 625 DCHECK(texture->id()); |
623 | 626 |
624 if (BindFramebufferToTexture(texture)) { | 627 if (BindFramebufferToTexture(texture)) { |
625 InitializeViewport(current_frame(), render_pass->output_rect, | 628 InitializeViewport(current_frame(), render_pass->output_rect, |
626 gfx::Rect(render_pass->output_rect.size()), | 629 gfx::Rect(render_pass->output_rect.size()), |
627 texture->size()); | 630 texture->size()); |
628 return true; | 631 return true; |
629 } | 632 } |
630 | 633 |
631 return false; | 634 return false; |
632 } | 635 } |
633 | 636 |
634 bool DirectRenderer::HasAllocatedResourcesForTesting(int render_pass_id) const { | 637 bool DirectRenderer::HasAllocatedResourcesForTesting(int render_pass_id) const { |
635 auto iter = render_pass_textures_.find(render_pass_id); | 638 auto iter = render_pass_textures_.find(render_pass_id); |
636 return iter != render_pass_textures_.end() && iter->second->id(); | 639 return iter != render_pass_textures_.end() && iter->second->id(); |
637 } | 640 } |
638 | 641 |
639 // static | 642 // static |
640 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { | 643 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { |
641 return render_pass->output_rect.size(); | 644 return render_pass->output_rect.size(); |
642 } | 645 } |
643 | 646 |
644 void DirectRenderer::SetCurrentFrameForTesting(const DrawingFrame& frame) { | 647 void DirectRenderer::SetCurrentFrameForTesting(const DrawingFrame& frame) { |
645 current_frame_valid_ = true; | 648 current_frame_valid_ = true; |
646 current_frame_ = frame; | 649 current_frame_ = frame; |
647 } | 650 } |
648 | 651 |
649 } // namespace cc | 652 } // namespace cc |
OLD | NEW |