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