Index: cc/output/direct_renderer.cc |
diff --git a/cc/output/direct_renderer.cc b/cc/output/direct_renderer.cc |
index d0798231bcb21092967c4ca6161b0881e6b54360..e34a331f06f54b05bf6d095adce847d17acee0db 100644 |
--- a/cc/output/direct_renderer.cc |
+++ b/cc/output/direct_renderer.cc |
@@ -87,6 +87,11 @@ void DirectRenderer::Initialize() { |
context_provider->ContextCapabilities().commit_overlay_planes) |
allow_empty_swap_ = true; |
+ if (context_provider && |
+ context_provider->ContextCapabilities().set_draw_rectangle) { |
+ use_set_draw_rectangle_ = true; |
+ } |
+ |
initialized_ = true; |
} |
@@ -498,10 +503,11 @@ void DirectRenderer::DrawRenderPass(DrawingFrame* frame, |
ComputeScissorRectForRenderPass(frame)); |
} |
- bool render_pass_is_clipped = |
- !render_pass_scissor_in_draw_space.Contains(surface_rect_in_draw_space); |
bool is_root_render_pass = |
frame->current_render_pass == frame->root_render_pass; |
+ bool render_pass_is_clipped = |
+ (use_set_draw_rectangle_ && is_root_render_pass) || |
+ !render_pass_scissor_in_draw_space.Contains(surface_rect_in_draw_space); |
bool has_external_stencil_test = |
is_root_render_pass && output_surface_->HasExternalStencilTest(); |
bool should_clear_surface = |
@@ -575,6 +581,10 @@ bool DirectRenderer::UseRenderPass(DrawingFrame* frame, |
frame->current_texture = NULL; |
sunnyps
2017/01/28 01:33:58
nit: nullptr
|
if (render_pass == frame->root_render_pass) { |
BindFramebufferToOutputSurface(frame); |
+ |
+ if (use_set_draw_rectangle_) |
+ output_surface_->SetDrawRectangle(frame->root_damage_rect); |
+ |
InitializeViewport(frame, render_pass->output_rect, |
gfx::Rect(frame->device_viewport_size), |
frame->device_viewport_size); |