Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: cc/output/direct_renderer.cc

Issue 2873593002: Force use of and cache render surface. (Closed)
Patch Set: Reduce unneeded code in surface aggregator and add more test. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 (render_pass->cache_render_surface &&
631 !render_pass->has_damage_from_contributing_content) {
632 return false;
633 }
634
635 if (current_frame()->ComputeScissorRectForRenderPass().IsEmpty())
636 return false;
637
630 if (BindFramebufferToTexture(texture)) { 638 if (BindFramebufferToTexture(texture)) {
631 InitializeViewport(current_frame(), render_pass->output_rect, 639 InitializeViewport(current_frame(), render_pass->output_rect,
632 gfx::Rect(render_pass->output_rect.size()), 640 gfx::Rect(render_pass->output_rect.size()),
633 texture->size()); 641 texture->size());
634 return true; 642 return true;
635 } 643 }
636 644
637 return false; 645 return false;
638 } 646 }
639 647
640 bool DirectRenderer::HasAllocatedResourcesForTesting(int render_pass_id) const { 648 bool DirectRenderer::HasAllocatedResourcesForTesting(int render_pass_id) const {
641 auto iter = render_pass_textures_.find(render_pass_id); 649 auto iter = render_pass_textures_.find(render_pass_id);
642 return iter != render_pass_textures_.end() && iter->second->id(); 650 return iter != render_pass_textures_.end() && iter->second->id();
643 } 651 }
644 652
645 // static 653 // static
646 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { 654 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) {
647 return render_pass->output_rect.size(); 655 return render_pass->output_rect.size();
648 } 656 }
649 657
650 void DirectRenderer::SetCurrentFrameForTesting(const DrawingFrame& frame) { 658 void DirectRenderer::SetCurrentFrameForTesting(const DrawingFrame& frame) {
651 current_frame_valid_ = true; 659 current_frame_valid_ = true;
652 current_frame_ = frame; 660 current_frame_ = frame;
653 } 661 }
654 662
655 } // namespace cc 663 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698