| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/mus/surfaces/direct_output_surface_ozone.h" | 5 #include "components/mus/surfaces/direct_output_surface_ozone.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 bool DirectOutputSurfaceOzone::IsDisplayedAsOverlayPlane() const { | 71 bool DirectOutputSurfaceOzone::IsDisplayedAsOverlayPlane() const { |
| 72 // TODO(rjkroege): implement remaining overlay functionality. | 72 // TODO(rjkroege): implement remaining overlay functionality. |
| 73 return true; | 73 return true; |
| 74 } | 74 } |
| 75 | 75 |
| 76 unsigned DirectOutputSurfaceOzone::GetOverlayTextureId() const { | 76 unsigned DirectOutputSurfaceOzone::GetOverlayTextureId() const { |
| 77 DCHECK(buffer_queue_); | 77 DCHECK(buffer_queue_); |
| 78 return buffer_queue_->current_texture_id(); | 78 return buffer_queue_->current_texture_id(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void DirectOutputSurfaceOzone::SwapBuffers(cc::CompositorFrame* frame) { | 81 void DirectOutputSurfaceOzone::SwapBuffers(cc::CompositorFrame frame) { |
| 82 DCHECK(buffer_queue_); | 82 DCHECK(buffer_queue_); |
| 83 DCHECK(frame->gl_frame_data); | 83 DCHECK(frame.gl_frame_data); |
| 84 | 84 |
| 85 buffer_queue_->SwapBuffers(frame->gl_frame_data->sub_buffer_rect); | 85 buffer_queue_->SwapBuffers(frame.gl_frame_data->sub_buffer_rect); |
| 86 | 86 |
| 87 // Code combining GpuBrowserCompositorOutputSurface + DirectOutputSurface | 87 // Code combining GpuBrowserCompositorOutputSurface + DirectOutputSurface |
| 88 if (frame->gl_frame_data->sub_buffer_rect == | 88 if (frame.gl_frame_data->sub_buffer_rect == |
| 89 gfx::Rect(frame->gl_frame_data->size)) { | 89 gfx::Rect(frame.gl_frame_data->size)) { |
| 90 context_provider_->ContextSupport()->Swap(); | 90 context_provider_->ContextSupport()->Swap(); |
| 91 } else { | 91 } else { |
| 92 context_provider_->ContextSupport()->PartialSwapBuffers( | 92 context_provider_->ContextSupport()->PartialSwapBuffers( |
| 93 frame->gl_frame_data->sub_buffer_rect); | 93 frame.gl_frame_data->sub_buffer_rect); |
| 94 } | 94 } |
| 95 | 95 |
| 96 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); | 96 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); |
| 97 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); | 97 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); |
| 98 gl->ShallowFlushCHROMIUM(); | 98 gl->ShallowFlushCHROMIUM(); |
| 99 | 99 |
| 100 gpu::SyncToken sync_token; | 100 gpu::SyncToken sync_token; |
| 101 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); | 101 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); |
| 102 | 102 |
| 103 client_->DidSwapBuffers(); | 103 client_->DidSwapBuffers(); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // must create the native window in the size that the hardware reports. | 156 // must create the native window in the size that the hardware reports. |
| 157 void DirectOutputSurfaceOzone::Reshape(const gfx::Size& size, | 157 void DirectOutputSurfaceOzone::Reshape(const gfx::Size& size, |
| 158 float scale_factor, | 158 float scale_factor, |
| 159 bool alpha) { | 159 bool alpha) { |
| 160 OutputSurface::Reshape(size, scale_factor, alpha); | 160 OutputSurface::Reshape(size, scale_factor, alpha); |
| 161 DCHECK(buffer_queue_); | 161 DCHECK(buffer_queue_); |
| 162 buffer_queue_->Reshape(SurfaceSize(), scale_factor); | 162 buffer_queue_->Reshape(SurfaceSize(), scale_factor); |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace mus | 165 } // namespace mus |
| OLD | NEW |