OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s
urface.h" | 5 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s
urface.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "cc/output/output_surface_client.h" | 9 #include "cc/output/output_surface_client.h" |
10 #include "cc/output/output_surface_frame.h" | 10 #include "cc/output/output_surface_frame.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 } | 67 } |
68 | 68 |
69 void GpuSurfacelessBrowserCompositorOutputSurface::SwapBuffers( | 69 void GpuSurfacelessBrowserCompositorOutputSurface::SwapBuffers( |
70 cc::OutputSurfaceFrame frame) { | 70 cc::OutputSurfaceFrame frame) { |
71 DCHECK(buffer_queue_); | 71 DCHECK(buffer_queue_); |
72 DCHECK(reshape_size_ == frame.size); | 72 DCHECK(reshape_size_ == frame.size); |
73 // TODO(ccameron): What if a swap comes again before OnGpuSwapBuffersCompleted | 73 // TODO(ccameron): What if a swap comes again before OnGpuSwapBuffersCompleted |
74 // happens, we'd see the wrong swap size there? | 74 // happens, we'd see the wrong swap size there? |
75 swap_size_ = reshape_size_; | 75 swap_size_ = reshape_size_; |
76 buffer_queue_->SwapBuffers(frame.sub_buffer_rect ? *frame.sub_buffer_rect | 76 buffer_queue_->SwapBuffers(frame.sub_buffer_rect ? *frame.sub_buffer_rect |
77 : gfx::Rect(swap_size_)); | 77 : frame.damage_rect); |
78 GpuBrowserCompositorOutputSurface::SwapBuffers(std::move(frame)); | 78 GpuBrowserCompositorOutputSurface::SwapBuffers(std::move(frame)); |
79 } | 79 } |
80 | 80 |
81 void GpuSurfacelessBrowserCompositorOutputSurface::BindFramebuffer() { | 81 void GpuSurfacelessBrowserCompositorOutputSurface::BindFramebuffer() { |
82 DCHECK(buffer_queue_); | 82 DCHECK(buffer_queue_); |
83 buffer_queue_->BindFramebuffer(); | 83 buffer_queue_->BindFramebuffer(); |
84 } | 84 } |
85 | 85 |
| 86 bool GpuSurfacelessBrowserCompositorOutputSurface::CanPartialDraw( |
| 87 const gfx::Rect& damage) { |
| 88 return buffer_queue_->CanPartialDraw(damage); |
| 89 } |
| 90 |
86 GLenum GpuSurfacelessBrowserCompositorOutputSurface:: | 91 GLenum GpuSurfacelessBrowserCompositorOutputSurface:: |
87 GetFramebufferCopyTextureFormat() { | 92 GetFramebufferCopyTextureFormat() { |
88 return buffer_queue_->internal_format(); | 93 return buffer_queue_->internal_format(); |
89 } | 94 } |
90 | 95 |
91 void GpuSurfacelessBrowserCompositorOutputSurface::Reshape( | 96 void GpuSurfacelessBrowserCompositorOutputSurface::Reshape( |
92 const gfx::Size& size, | 97 const gfx::Size& size, |
93 float device_scale_factor, | 98 float device_scale_factor, |
94 const gfx::ColorSpace& color_space, | 99 const gfx::ColorSpace& color_space, |
95 bool has_alpha, | 100 bool has_alpha, |
(...skipping 18 matching lines...) Expand all Loading... |
114 force_swap = true; | 119 force_swap = true; |
115 } | 120 } |
116 buffer_queue_->PageFlipComplete(); | 121 buffer_queue_->PageFlipComplete(); |
117 GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted( | 122 GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted( |
118 latency_info, result, params_mac); | 123 latency_info, result, params_mac); |
119 if (force_swap) | 124 if (force_swap) |
120 client_->SetNeedsRedrawRect(gfx::Rect(swap_size_)); | 125 client_->SetNeedsRedrawRect(gfx::Rect(swap_size_)); |
121 } | 126 } |
122 | 127 |
123 } // namespace content | 128 } // namespace content |
OLD | NEW |