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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: cc/output/direct_renderer.cc
diff --git a/cc/output/direct_renderer.cc b/cc/output/direct_renderer.cc
index db3b42a38b74997720c5de12c6de1e11382fb4d5..bf7bd04136f5c35ef715b46acb7faa9d753a3a09 100644
--- a/cc/output/direct_renderer.cc
+++ b/cc/output/direct_renderer.cc
@@ -72,13 +72,22 @@ DirectRenderer::DirectRenderer(const RendererSettings* settings,
: settings_(settings),
output_surface_(output_surface),
resource_provider_(resource_provider),
- overlay_processor_(new OverlayProcessor(output_surface)) {
- // TODO(danakj): This should not be happening in the constructor.
- overlay_processor_->Initialize();
-}
+ overlay_processor_(new OverlayProcessor(output_surface)) {}
DirectRenderer::~DirectRenderer() = default;
+void DirectRenderer::Initialize() {
+ overlay_processor_->Initialize();
+
+ auto* context_provider = output_surface_->context_provider();
+
+ 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
+ allow_empty_swap_ = use_partial_swap_;
+ if (context_provider &&
+ context_provider->ContextCapabilities().commit_overlay_planes)
+ allow_empty_swap_ = true;
+}
+
// static
gfx::RectF DirectRenderer::QuadVertexRect() {
return gfx::RectF(-0.5f, -0.5f, 1.f, 1.f);
@@ -261,11 +270,11 @@ void DirectRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order,
// We can skip all drawing if the damage rect is now empty.
bool skip_drawing_root_render_pass =
- frame.root_damage_rect.IsEmpty() && Capabilities().allow_empty_swap;
+ frame.root_damage_rect.IsEmpty() && allow_empty_swap_;
// If we have to draw but don't support partial swap, the whole output should
// be considered damaged.
- if (!skip_drawing_root_render_pass && !Capabilities().using_partial_swap)
+ if (!skip_drawing_root_render_pass && !use_partial_swap_)
frame.root_damage_rect = root_render_pass->output_rect;
if (skip_drawing_root_render_pass) {
@@ -451,7 +460,7 @@ void DirectRenderer::DrawRenderPass(DrawingFrame* frame,
DeviceViewportRectInDrawSpace(frame));
}
- if (Capabilities().using_partial_swap) {
+ if (use_partial_swap_) {
render_pass_scissor_in_draw_space.Intersect(
ComputeScissorRectForRenderPass(frame));
}

Powered by Google App Engine
This is Rietveld 408576698