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

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

Issue 2253823002: cc: Remove all impl-side caps from RendererCapabilitiesImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@delete-renderer-base-class
Patch Set: Created 4 years, 4 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 DirectRenderer::DrawingFrame::DrawingFrame() = default; 66 DirectRenderer::DrawingFrame::DrawingFrame() = default;
67 DirectRenderer::DrawingFrame::~DrawingFrame() = default; 67 DirectRenderer::DrawingFrame::~DrawingFrame() = default;
68 68
69 DirectRenderer::DirectRenderer(const RendererSettings* settings, 69 DirectRenderer::DirectRenderer(const RendererSettings* settings,
70 OutputSurface* output_surface, 70 OutputSurface* output_surface,
71 ResourceProvider* resource_provider) 71 ResourceProvider* resource_provider)
72 : settings_(settings), 72 : settings_(settings),
73 output_surface_(output_surface), 73 output_surface_(output_surface),
74 resource_provider_(resource_provider), 74 resource_provider_(resource_provider),
75 overlay_processor_(new OverlayProcessor(output_surface)) { 75 overlay_processor_(new OverlayProcessor(output_surface)) {}
76 // TODO(danakj): This should not be happening in the constructor.
77 overlay_processor_->Initialize();
78 }
79 76
80 DirectRenderer::~DirectRenderer() = default; 77 DirectRenderer::~DirectRenderer() = default;
81 78
79 void DirectRenderer::Initialize() {
80 overlay_processor_->Initialize();
81
82 auto* context_provider = output_surface_->context_provider();
83
84 use_partial_swap_ = settings_->partial_swap_enabled && CanPartialSwap();
danakj 2016/08/17 02:06:43 This is a behaviour change. What it changed is tha
enne (OOO) 2016/08/17 17:48:42 Yeah, this sounds good to me. We've had a bunch o
85 allow_empty_swap_ = use_partial_swap_;
86 if (context_provider &&
87 context_provider->ContextCapabilities().commit_overlay_planes)
88 allow_empty_swap_ = true;
89 }
90
82 // static 91 // static
83 gfx::RectF DirectRenderer::QuadVertexRect() { 92 gfx::RectF DirectRenderer::QuadVertexRect() {
84 return gfx::RectF(-0.5f, -0.5f, 1.f, 1.f); 93 return gfx::RectF(-0.5f, -0.5f, 1.f, 1.f);
85 } 94 }
86 95
87 // static 96 // static
88 void DirectRenderer::QuadRectTransform(gfx::Transform* quad_rect_transform, 97 void DirectRenderer::QuadRectTransform(gfx::Transform* quad_rect_transform,
89 const gfx::Transform& quad_transform, 98 const gfx::Transform& quad_transform,
90 const gfx::RectF& quad_rect) { 99 const gfx::RectF& quad_rect) {
91 *quad_rect_transform = quad_transform; 100 *quad_rect_transform = quad_transform;
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 } 263 }
255 264
256 // Attempt to replace some or all of the quads of the root render pass with 265 // Attempt to replace some or all of the quads of the root render pass with
257 // overlays. 266 // overlays.
258 overlay_processor_->ProcessForOverlays( 267 overlay_processor_->ProcessForOverlays(
259 resource_provider_, root_render_pass, &frame.overlay_list, 268 resource_provider_, root_render_pass, &frame.overlay_list,
260 &frame.ca_layer_overlay_list, &frame.root_damage_rect); 269 &frame.ca_layer_overlay_list, &frame.root_damage_rect);
261 270
262 // We can skip all drawing if the damage rect is now empty. 271 // We can skip all drawing if the damage rect is now empty.
263 bool skip_drawing_root_render_pass = 272 bool skip_drawing_root_render_pass =
264 frame.root_damage_rect.IsEmpty() && Capabilities().allow_empty_swap; 273 frame.root_damage_rect.IsEmpty() && allow_empty_swap_;
265 274
266 // If we have to draw but don't support partial swap, the whole output should 275 // If we have to draw but don't support partial swap, the whole output should
267 // be considered damaged. 276 // be considered damaged.
268 if (!skip_drawing_root_render_pass && !Capabilities().using_partial_swap) 277 if (!skip_drawing_root_render_pass && !use_partial_swap_)
269 frame.root_damage_rect = root_render_pass->output_rect; 278 frame.root_damage_rect = root_render_pass->output_rect;
270 279
271 if (skip_drawing_root_render_pass) { 280 if (skip_drawing_root_render_pass) {
272 // If any of the overlays is the output surface, then ensure that the 281 // If any of the overlays is the output surface, then ensure that the
273 // backbuffer be allocated (allocation of the backbuffer is a side-effect 282 // backbuffer be allocated (allocation of the backbuffer is a side-effect
274 // of BindFramebufferToOutputSurface). 283 // of BindFramebufferToOutputSurface).
275 for (auto& overlay : frame.overlay_list) { 284 for (auto& overlay : frame.overlay_list) {
276 if (overlay.use_output_surface_for_resource) { 285 if (overlay.use_output_surface_for_resource) {
277 BindFramebufferToOutputSurface(&frame); 286 BindFramebufferToOutputSurface(&frame);
278 break; 287 break;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 453
445 const gfx::Rect surface_rect_in_draw_space = 454 const gfx::Rect surface_rect_in_draw_space =
446 OutputSurfaceRectInDrawSpace(frame); 455 OutputSurfaceRectInDrawSpace(frame);
447 gfx::Rect render_pass_scissor_in_draw_space = surface_rect_in_draw_space; 456 gfx::Rect render_pass_scissor_in_draw_space = surface_rect_in_draw_space;
448 457
449 if (frame->current_render_pass == frame->root_render_pass) { 458 if (frame->current_render_pass == frame->root_render_pass) {
450 render_pass_scissor_in_draw_space.Intersect( 459 render_pass_scissor_in_draw_space.Intersect(
451 DeviceViewportRectInDrawSpace(frame)); 460 DeviceViewportRectInDrawSpace(frame));
452 } 461 }
453 462
454 if (Capabilities().using_partial_swap) { 463 if (use_partial_swap_) {
455 render_pass_scissor_in_draw_space.Intersect( 464 render_pass_scissor_in_draw_space.Intersect(
456 ComputeScissorRectForRenderPass(frame)); 465 ComputeScissorRectForRenderPass(frame));
457 } 466 }
458 467
459 if (NeedDeviceClip(frame)) { 468 if (NeedDeviceClip(frame)) {
460 render_pass_scissor_in_draw_space.Intersect( 469 render_pass_scissor_in_draw_space.Intersect(
461 DeviceClipRectInDrawSpace(frame)); 470 DeviceClipRectInDrawSpace(frame));
462 } 471 }
463 472
464 bool render_pass_is_clipped = 473 bool render_pass_is_clipped =
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 auto iter = render_pass_textures_.find(id); 582 auto iter = render_pass_textures_.find(id);
574 return iter != render_pass_textures_.end() && iter->second->id(); 583 return iter != render_pass_textures_.end() && iter->second->id();
575 } 584 }
576 585
577 // static 586 // static
578 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { 587 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) {
579 return render_pass->output_rect.size(); 588 return render_pass->output_rect.size();
580 } 589 }
581 590
582 } // namespace cc 591 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698