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

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

Issue 2646243002: Use IDCompositionSurface to implement DirectCompositionSurfaceWin. (Closed)
Patch Set: rebase Created 3 years, 10 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 <unordered_map> 9 #include <unordered_map>
10 #include <utility> 10 #include <utility>
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 overlay_processor_->Initialize(); 81 overlay_processor_->Initialize();
82 82
83 auto* context_provider = output_surface_->context_provider(); 83 auto* context_provider = output_surface_->context_provider();
84 84
85 use_partial_swap_ = settings_->partial_swap_enabled && CanPartialSwap(); 85 use_partial_swap_ = settings_->partial_swap_enabled && CanPartialSwap();
86 allow_empty_swap_ = use_partial_swap_; 86 allow_empty_swap_ = use_partial_swap_;
87 if (context_provider && 87 if (context_provider &&
88 context_provider->ContextCapabilities().commit_overlay_planes) 88 context_provider->ContextCapabilities().commit_overlay_planes)
89 allow_empty_swap_ = true; 89 allow_empty_swap_ = true;
90 90
91 if (context_provider &&
92 context_provider->ContextCapabilities().set_draw_rectangle) {
danakj 2017/02/15 16:01:01 nit: no {}, or merge this with the conditions abov
93 use_set_draw_rectangle_ = true;
94 }
95
91 initialized_ = true; 96 initialized_ = true;
92 } 97 }
93 98
94 // static 99 // static
95 gfx::RectF DirectRenderer::QuadVertexRect() { 100 gfx::RectF DirectRenderer::QuadVertexRect() {
96 return gfx::RectF(-0.5f, -0.5f, 1.f, 1.f); 101 return gfx::RectF(-0.5f, -0.5f, 1.f, 1.f);
97 } 102 }
98 103
99 // static 104 // static
100 void DirectRenderer::QuadRectTransform(gfx::Transform* quad_rect_transform, 105 void DirectRenderer::QuadRectTransform(gfx::Transform* quad_rect_transform,
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 current_frame()->root_render_pass) { 508 current_frame()->root_render_pass) {
504 render_pass_scissor_in_draw_space.Intersect( 509 render_pass_scissor_in_draw_space.Intersect(
505 DeviceViewportRectInDrawSpace()); 510 DeviceViewportRectInDrawSpace());
506 } 511 }
507 512
508 if (use_partial_swap_) { 513 if (use_partial_swap_) {
509 render_pass_scissor_in_draw_space.Intersect( 514 render_pass_scissor_in_draw_space.Intersect(
510 current_frame()->ComputeScissorRectForRenderPass()); 515 current_frame()->ComputeScissorRectForRenderPass());
511 } 516 }
512 517
513 bool render_pass_is_clipped =
514 !render_pass_scissor_in_draw_space.Contains(surface_rect_in_draw_space);
515 bool is_root_render_pass = 518 bool is_root_render_pass =
516 current_frame()->current_render_pass == current_frame()->root_render_pass; 519 current_frame()->current_render_pass == current_frame()->root_render_pass;
520 bool render_pass_is_clipped =
danakj 2017/02/15 16:01:01 Can you explain why use_set_draw_rectangle_ implie
521 (use_set_draw_rectangle_ && is_root_render_pass) ||
522 !render_pass_scissor_in_draw_space.Contains(surface_rect_in_draw_space);
517 bool has_external_stencil_test = 523 bool has_external_stencil_test =
518 is_root_render_pass && output_surface_->HasExternalStencilTest(); 524 is_root_render_pass && output_surface_->HasExternalStencilTest();
519 bool should_clear_surface = 525 bool should_clear_surface =
520 !has_external_stencil_test && 526 !has_external_stencil_test &&
521 (!is_root_render_pass || settings_->should_clear_root_render_pass); 527 (!is_root_render_pass || settings_->should_clear_root_render_pass);
522 528
523 // If |has_external_stencil_test| we can't discard or clear. Make sure we 529 // If |has_external_stencil_test| we can't discard or clear. Make sure we
524 // don't need to. 530 // don't need to.
525 DCHECK(!has_external_stencil_test || 531 DCHECK(!has_external_stencil_test ||
526 !current_frame()->current_render_pass->has_transparent_background); 532 !current_frame()->current_render_pass->has_transparent_background);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 581
576 DoDrawQuad(&quad, nullptr); 582 DoDrawQuad(&quad, nullptr);
577 } 583 }
578 FlushPolygons(&poly_list, render_pass_scissor_in_draw_space, 584 FlushPolygons(&poly_list, render_pass_scissor_in_draw_space,
579 render_pass_is_clipped); 585 render_pass_is_clipped);
580 FinishDrawingQuadList(); 586 FinishDrawingQuadList();
581 } 587 }
582 588
583 bool DirectRenderer::UseRenderPass(const RenderPass* render_pass) { 589 bool DirectRenderer::UseRenderPass(const RenderPass* render_pass) {
584 current_frame()->current_render_pass = render_pass; 590 current_frame()->current_render_pass = render_pass;
585 current_frame()->current_texture = NULL; 591 current_frame()->current_texture = nullptr;
586 if (render_pass == current_frame()->root_render_pass) { 592 if (render_pass == current_frame()->root_render_pass) {
587 BindFramebufferToOutputSurface(); 593 BindFramebufferToOutputSurface();
594
595 if (use_set_draw_rectangle_)
596 output_surface_->SetDrawRectangle(current_frame()->root_damage_rect);
588 InitializeViewport(current_frame(), render_pass->output_rect, 597 InitializeViewport(current_frame(), render_pass->output_rect,
589 gfx::Rect(current_frame()->device_viewport_size), 598 gfx::Rect(current_frame()->device_viewport_size),
590 current_frame()->device_viewport_size); 599 current_frame()->device_viewport_size);
591 return true; 600 return true;
592 } 601 }
593 602
594 ScopedResource* texture = render_pass_textures_[render_pass->id].get(); 603 ScopedResource* texture = render_pass_textures_[render_pass->id].get();
595 DCHECK(texture); 604 DCHECK(texture);
596 605
597 gfx::Size size = RenderPassTextureSize(render_pass); 606 gfx::Size size = RenderPassTextureSize(render_pass);
(...skipping 25 matching lines...) Expand all
623 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { 632 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) {
624 return render_pass->output_rect.size(); 633 return render_pass->output_rect.size();
625 } 634 }
626 635
627 void DirectRenderer::SetCurrentFrameForTesting(const DrawingFrame& frame) { 636 void DirectRenderer::SetCurrentFrameForTesting(const DrawingFrame& frame) {
628 current_frame_valid_ = true; 637 current_frame_valid_ = true;
629 current_frame_ = frame; 638 current_frame_ = frame;
630 } 639 }
631 640
632 } // namespace cc 641 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698