Chromium Code Reviews| Index: content/browser/compositor/gpu_browser_compositor_output_surface.cc |
| diff --git a/content/browser/compositor/gpu_browser_compositor_output_surface.cc b/content/browser/compositor/gpu_browser_compositor_output_surface.cc |
| index 8ad8384dbaf8e62208841f95deb10c877d651ceb..6ee9f63489f7844f91b1952db99d1c3f5827c484 100644 |
| --- a/content/browser/compositor/gpu_browser_compositor_output_surface.cc |
| +++ b/content/browser/compositor/gpu_browser_compositor_output_surface.cc |
| @@ -88,6 +88,8 @@ void GpuBrowserCompositorOutputSurface::Reshape( |
| const gfx::ColorSpace& color_space, |
| bool has_alpha, |
| bool use_stencil) { |
| + size_ = size; |
| + has_set_draw_rectangle_since_last_resize_ = false; |
| context_provider()->ContextGL()->ResizeCHROMIUM( |
| size.width(), size.height(), device_scale_factor, has_alpha); |
| } |
| @@ -108,6 +110,8 @@ void GpuBrowserCompositorOutputSurface::SwapBuffers( |
| } |
| } |
| + set_draw_rectangle_for_frame_ = false; |
| + |
| if (swap_rect == gfx::Rect(frame.size)) |
| context_provider_->ContextSupport()->Swap(); |
| else |
| @@ -136,6 +140,19 @@ void GpuBrowserCompositorOutputSurface::SetSurfaceSuspendedForRecycle( |
| bool suspended) {} |
| #endif |
| +void GpuBrowserCompositorOutputSurface::SetDrawRectangle( |
| + const gfx::Rect& rect) { |
| + if (set_draw_rectangle_for_frame_) |
| + return; |
| + DCHECK(gfx::Rect(size_).Contains(rect)); |
| + DCHECK(has_set_draw_rectangle_since_last_resize_ || |
|
dcheng
2017/02/15 06:57:05
Is it OK to DCHECK here? I wonder because DirectCo
|
| + (gfx::Rect(size_) == rect)); |
| + set_draw_rectangle_for_frame_ = true; |
| + has_set_draw_rectangle_since_last_resize_ = true; |
| + context_provider()->ContextGL()->SetDrawRectangleCHROMIUM( |
| + rect.x(), rect.y(), rect.width(), rect.height()); |
| +} |
| + |
| gpu::CommandBufferProxyImpl* |
| GpuBrowserCompositorOutputSurface::GetCommandBufferProxy() { |
| ui::ContextProviderCommandBuffer* provider_command_buffer = |