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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 return buffer_queue_->current_texture_id(); | 66 return buffer_queue_->current_texture_id(); |
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); | 76 gfx::Rect damage(swap_size_); |
77 if (frame.sub_buffer_rect) { | |
danakj
2017/02/22 00:36:57
no {} :)
| |
78 damage = *frame.sub_buffer_rect; | |
79 } | |
80 buffer_queue_->SwapBuffers(damage); | |
danakj
2017/02/22 00:36:57
it might be more readable with a ternary
buffer
halliwell
2017/02/22 14:19:28
I prefer the ternary form, yes.
| |
77 GpuBrowserCompositorOutputSurface::SwapBuffers(std::move(frame)); | 81 GpuBrowserCompositorOutputSurface::SwapBuffers(std::move(frame)); |
78 } | 82 } |
79 | 83 |
80 void GpuSurfacelessBrowserCompositorOutputSurface::BindFramebuffer() { | 84 void GpuSurfacelessBrowserCompositorOutputSurface::BindFramebuffer() { |
81 DCHECK(buffer_queue_); | 85 DCHECK(buffer_queue_); |
82 buffer_queue_->BindFramebuffer(); | 86 buffer_queue_->BindFramebuffer(); |
83 } | 87 } |
84 | 88 |
85 GLenum GpuSurfacelessBrowserCompositorOutputSurface:: | 89 GLenum GpuSurfacelessBrowserCompositorOutputSurface:: |
86 GetFramebufferCopyTextureFormat() { | 90 GetFramebufferCopyTextureFormat() { |
(...skipping 26 matching lines...) Expand all Loading... | |
113 force_swap = true; | 117 force_swap = true; |
114 } | 118 } |
115 buffer_queue_->PageFlipComplete(); | 119 buffer_queue_->PageFlipComplete(); |
116 GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted( | 120 GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted( |
117 latency_info, result, params_mac); | 121 latency_info, result, params_mac); |
118 if (force_swap) | 122 if (force_swap) |
119 client_->SetNeedsRedrawRect(gfx::Rect(swap_size_)); | 123 client_->SetNeedsRedrawRect(gfx::Rect(swap_size_)); |
120 } | 124 } |
121 | 125 |
122 } // namespace content | 126 } // namespace content |
OLD | NEW |