OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/gles2/gl_surface_adapter.h" | 5 #include "components/mus/gles2/gl_surface_adapter.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 | 8 |
9 namespace mus { | 9 namespace mus { |
10 | 10 |
11 GLSurfaceAdapterMus::GLSurfaceAdapterMus(scoped_refptr<gfx::GLSurface> surface) | 11 GLSurfaceAdapterMus::GLSurfaceAdapterMus(scoped_refptr<gl::GLSurface> surface) |
12 : gfx::GLSurfaceAdapter(surface.get()), | 12 : gl::GLSurfaceAdapter(surface.get()), |
13 surface_(surface), | 13 surface_(surface), |
14 weak_ptr_factory_(this) {} | 14 weak_ptr_factory_(this) {} |
15 | 15 |
16 GLSurfaceAdapterMus::~GLSurfaceAdapterMus() {} | 16 GLSurfaceAdapterMus::~GLSurfaceAdapterMus() {} |
17 | 17 |
18 void GLSurfaceAdapterMus::SwapBuffersAsync( | 18 void GLSurfaceAdapterMus::SwapBuffersAsync( |
19 const GLSurface::SwapCompletionCallback& callback) { | 19 const GLSurface::SwapCompletionCallback& callback) { |
20 gfx::GLSurfaceAdapter::SwapBuffersAsync( | 20 gl::GLSurfaceAdapter::SwapBuffersAsync( |
21 base::Bind(&GLSurfaceAdapterMus::WrappedCallbackForSwapBuffersAsync, | 21 base::Bind(&GLSurfaceAdapterMus::WrappedCallbackForSwapBuffersAsync, |
22 weak_ptr_factory_.GetWeakPtr(), callback)); | 22 weak_ptr_factory_.GetWeakPtr(), callback)); |
23 } | 23 } |
24 | 24 |
25 void GLSurfaceAdapterMus::PostSubBufferAsync( | 25 void GLSurfaceAdapterMus::PostSubBufferAsync( |
26 int x, | 26 int x, |
27 int y, | 27 int y, |
28 int width, | 28 int width, |
29 int height, | 29 int height, |
30 const GLSurface::SwapCompletionCallback& callback) { | 30 const GLSurface::SwapCompletionCallback& callback) { |
31 gfx::GLSurfaceAdapter::PostSubBufferAsync( | 31 gl::GLSurfaceAdapter::PostSubBufferAsync( |
32 x, y, width, height, | 32 x, y, width, height, |
33 base::Bind(&GLSurfaceAdapterMus::WrappedCallbackForSwapBuffersAsync, | 33 base::Bind(&GLSurfaceAdapterMus::WrappedCallbackForSwapBuffersAsync, |
34 weak_ptr_factory_.GetWeakPtr(), callback)); | 34 weak_ptr_factory_.GetWeakPtr(), callback)); |
35 } | 35 } |
36 | 36 |
37 void GLSurfaceAdapterMus::CommitOverlayPlanesAsync( | 37 void GLSurfaceAdapterMus::CommitOverlayPlanesAsync( |
38 const GLSurface::SwapCompletionCallback& callback) { | 38 const GLSurface::SwapCompletionCallback& callback) { |
39 gfx::GLSurfaceAdapter::CommitOverlayPlanesAsync( | 39 gl::GLSurfaceAdapter::CommitOverlayPlanesAsync( |
40 base::Bind(&GLSurfaceAdapterMus::WrappedCallbackForSwapBuffersAsync, | 40 base::Bind(&GLSurfaceAdapterMus::WrappedCallbackForSwapBuffersAsync, |
41 weak_ptr_factory_.GetWeakPtr(), callback)); | 41 weak_ptr_factory_.GetWeakPtr(), callback)); |
42 } | 42 } |
43 | 43 |
44 void GLSurfaceAdapterMus::WrappedCallbackForSwapBuffersAsync( | 44 void GLSurfaceAdapterMus::WrappedCallbackForSwapBuffersAsync( |
45 const gfx::GLSurface::SwapCompletionCallback& original_callback, | 45 const gl::GLSurface::SwapCompletionCallback& original_callback, |
46 gfx::SwapResult result) { | 46 gfx::SwapResult result) { |
47 if (!adapter_callback_.is_null()) | 47 if (!adapter_callback_.is_null()) |
48 adapter_callback_.Run(result); | 48 adapter_callback_.Run(result); |
49 original_callback.Run(result); | 49 original_callback.Run(result); |
50 } | 50 } |
51 | 51 |
52 void GLSurfaceAdapterMus::SetGpuCompletedSwapBuffersCallback( | 52 void GLSurfaceAdapterMus::SetGpuCompletedSwapBuffersCallback( |
53 gfx::GLSurface::SwapCompletionCallback callback) { | 53 gl::GLSurface::SwapCompletionCallback callback) { |
54 adapter_callback_ = std::move(callback); | 54 adapter_callback_ = std::move(callback); |
55 } | 55 } |
56 | 56 |
57 } // namespace mus | 57 } // namespace mus |
OLD | NEW |