| 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/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
| 10 #include "cc/output/output_surface_client.h" | 10 #include "cc/output/output_surface_client.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 } | 87 } |
| 88 | 88 |
| 89 GLenum GpuSurfacelessBrowserCompositorOutputSurface:: | 89 GLenum GpuSurfacelessBrowserCompositorOutputSurface:: |
| 90 GetFramebufferCopyTextureFormat() { | 90 GetFramebufferCopyTextureFormat() { |
| 91 return buffer_queue_->internal_format(); | 91 return buffer_queue_->internal_format(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void GpuSurfacelessBrowserCompositorOutputSurface::Reshape( | 94 void GpuSurfacelessBrowserCompositorOutputSurface::Reshape( |
| 95 const gfx::Size& size, | 95 const gfx::Size& size, |
| 96 float scale_factor, | 96 float scale_factor, |
| 97 const gfx::ColorProfile& color_profile, |
| 97 bool alpha) { | 98 bool alpha) { |
| 98 GpuBrowserCompositorOutputSurface::Reshape(size, scale_factor, alpha); | 99 GpuBrowserCompositorOutputSurface::Reshape(size, scale_factor, color_profile, |
| 100 alpha); |
| 99 DCHECK(buffer_queue_); | 101 DCHECK(buffer_queue_); |
| 102 // TODO(ccameron): Plumb the color profile to the output GpuMemoryBuffer. |
| 103 // https://crbug.com/622133 |
| 100 buffer_queue_->Reshape(SurfaceSize(), scale_factor); | 104 buffer_queue_->Reshape(SurfaceSize(), scale_factor); |
| 101 } | 105 } |
| 102 | 106 |
| 103 void GpuSurfacelessBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted( | 107 void GpuSurfacelessBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted( |
| 104 const std::vector<ui::LatencyInfo>& latency_info, | 108 const std::vector<ui::LatencyInfo>& latency_info, |
| 105 gfx::SwapResult result, | 109 gfx::SwapResult result, |
| 106 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) { | 110 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) { |
| 107 bool force_swap = false; | 111 bool force_swap = false; |
| 108 if (result == gfx::SwapResult::SWAP_NAK_RECREATE_BUFFERS) { | 112 if (result == gfx::SwapResult::SWAP_NAK_RECREATE_BUFFERS) { |
| 109 // Even through the swap failed, this is a fixable error so we can pretend | 113 // Even through the swap failed, this is a fixable error so we can pretend |
| 110 // it succeeded to the rest of the system. | 114 // it succeeded to the rest of the system. |
| 111 result = gfx::SwapResult::SWAP_ACK; | 115 result = gfx::SwapResult::SWAP_ACK; |
| 112 buffer_queue_->RecreateBuffers(); | 116 buffer_queue_->RecreateBuffers(); |
| 113 force_swap = true; | 117 force_swap = true; |
| 114 } | 118 } |
| 115 GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted( | 119 GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted( |
| 116 latency_info, result, params_mac); | 120 latency_info, result, params_mac); |
| 117 if (force_swap) | 121 if (force_swap) |
| 118 client_->SetNeedsRedrawRect(gfx::Rect(SurfaceSize())); | 122 client_->SetNeedsRedrawRect(gfx::Rect(SurfaceSize())); |
| 119 } | 123 } |
| 120 | 124 |
| 121 } // namespace content | 125 } // namespace content |
| OLD | NEW |