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 #ifndef UI_GL_GL_SURFACE_OSMESA_X11_H_ | 5 #ifndef UI_GL_GL_SURFACE_OSMESA_X11_H_ |
6 #define UI_GL_GL_SURFACE_OSMESA_X11_H_ | 6 #define UI_GL_GL_SURFACE_OSMESA_X11_H_ |
7 | 7 |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
12 #include "ui/gl/gl_export.h" | 12 #include "ui/gl/gl_export.h" |
13 #include "ui/gl/gl_surface.h" | 13 #include "ui/gl/gl_surface.h" |
14 #include "ui/gl/gl_surface_osmesa.h" | 14 #include "ui/gl/gl_surface_osmesa.h" |
15 | 15 |
16 namespace gl { | 16 namespace gl { |
17 | 17 |
18 // This OSMesa GL surface can use XLib to swap the contents of the buffer to a | 18 // This OSMesa GL surface can use XLib to swap the contents of the buffer to a |
19 // view. | 19 // view. |
20 class GL_EXPORT GLSurfaceOSMesaX11 : public GLSurfaceOSMesa { | 20 class GL_EXPORT GLSurfaceOSMesaX11 : public GLSurfaceOSMesa { |
21 public: | 21 public: |
22 explicit GLSurfaceOSMesaX11(gfx::AcceleratedWidget window); | 22 explicit GLSurfaceOSMesaX11(gfx::AcceleratedWidget window); |
23 | 23 |
24 static bool InitializeOneOff(); | 24 static bool InitializeOneOff(); |
25 | 25 |
26 // Implement a subset of GLSurface. | 26 // Implement a subset of GLSurface. |
27 bool Initialize(GLSurface::Format format) override; | 27 bool Initialize(GLSurfaceFormat format) override; |
28 void Destroy() override; | 28 void Destroy() override; |
29 bool Resize(const gfx::Size& new_size, | 29 bool Resize(const gfx::Size& new_size, |
30 float scale_factor, | 30 float scale_factor, |
31 bool alpha) override; | 31 bool alpha) override; |
32 bool IsOffscreen() override; | 32 bool IsOffscreen() override; |
33 gfx::SwapResult SwapBuffers() override; | 33 gfx::SwapResult SwapBuffers() override; |
34 bool SupportsPostSubBuffer() override; | 34 bool SupportsPostSubBuffer() override; |
35 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; | 35 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; |
36 | 36 |
37 protected: | 37 protected: |
38 ~GLSurfaceOSMesaX11() override; | 38 ~GLSurfaceOSMesaX11() override; |
39 | 39 |
40 private: | 40 private: |
41 Display* xdisplay_; | 41 Display* xdisplay_; |
42 GC window_graphics_context_; | 42 GC window_graphics_context_; |
43 gfx::AcceleratedWidget window_; | 43 gfx::AcceleratedWidget window_; |
44 GC pixmap_graphics_context_; | 44 GC pixmap_graphics_context_; |
45 Pixmap pixmap_; | 45 Pixmap pixmap_; |
46 | 46 |
47 DISALLOW_COPY_AND_ASSIGN(GLSurfaceOSMesaX11); | 47 DISALLOW_COPY_AND_ASSIGN(GLSurfaceOSMesaX11); |
48 }; | 48 }; |
49 | 49 |
50 } // namespace gl | 50 } // namespace gl |
51 | 51 |
52 #endif // UI_GL_GL_SURFACE_OSMESA_X11_H_ | 52 #endif // UI_GL_GL_SURFACE_OSMESA_X11_H_ |
OLD | NEW |