| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_GLX_H_ | 5 #ifndef UI_GL_GL_SURFACE_GLX_H_ |
| 6 #define UI_GL_GL_SURFACE_GLX_H_ | 6 #define UI_GL_GL_SURFACE_GLX_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "ui/events/platform/platform_event_dispatcher.h" | 11 #include "ui/events/platform/platform_event_dispatcher.h" |
| 12 #include "ui/gfx/geometry/size.h" | 12 #include "ui/gfx/geometry/size.h" |
| 13 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
| 14 #include "ui/gfx/vsync_provider.h" | 14 #include "ui/gfx/vsync_provider.h" |
| 15 #include "ui/gfx/x/x11_types.h" | 15 #include "ui/gfx/x/x11_types.h" |
| 16 #include "ui/gl/gl_export.h" | 16 #include "ui/gl/gl_export.h" |
| 17 #include "ui/gl/gl_surface.h" | 17 #include "ui/gl/gl_surface.h" |
| 18 | 18 |
| 19 namespace gfx { | 19 namespace gfx { |
| 20 | 20 |
| 21 // Base class for GLX surfaces. | 21 // Base class for GLX surfaces. |
| 22 class GL_EXPORT GLSurfaceGLX : public GLSurface { | 22 class GL_EXPORT GLSurfaceGLX : public GLSurface { |
| 23 public: | 23 public: |
| 24 GLSurfaceGLX(); | 24 explicit GLSurfaceGLX( |
| 25 const gfx::SurfaceConfiguration& requested_configuration); |
| 25 | 26 |
| 26 static bool InitializeOneOff(); | 27 static bool InitializeOneOff(); |
| 27 | 28 |
| 28 // These aren't particularly tied to surfaces, but since we already | 29 // These aren't particularly tied to surfaces, but since we already |
| 29 // have the static InitializeOneOff here, it's easiest to reuse its | 30 // have the static InitializeOneOff here, it's easiest to reuse its |
| 30 // initialization guards. | 31 // initialization guards. |
| 31 static const char* GetGLXExtensions(); | 32 static const char* GetGLXExtensions(); |
| 32 static bool HasGLXExtension(const char* name); | 33 static bool HasGLXExtension(const char* name); |
| 33 static bool IsCreateContextSupported(); | 34 static bool IsCreateContextSupported(); |
| 34 static bool IsCreateContextRobustnessSupported(); | 35 static bool IsCreateContextRobustnessSupported(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 45 ~GLSurfaceGLX() override; | 46 ~GLSurfaceGLX() override; |
| 46 | 47 |
| 47 private: | 48 private: |
| 48 DISALLOW_COPY_AND_ASSIGN(GLSurfaceGLX); | 49 DISALLOW_COPY_AND_ASSIGN(GLSurfaceGLX); |
| 49 }; | 50 }; |
| 50 | 51 |
| 51 // A surface used to render to a view. | 52 // A surface used to render to a view. |
| 52 class GL_EXPORT NativeViewGLSurfaceGLX : public GLSurfaceGLX, | 53 class GL_EXPORT NativeViewGLSurfaceGLX : public GLSurfaceGLX, |
| 53 public ui::PlatformEventDispatcher { | 54 public ui::PlatformEventDispatcher { |
| 54 public: | 55 public: |
| 55 explicit NativeViewGLSurfaceGLX(gfx::AcceleratedWidget window); | 56 NativeViewGLSurfaceGLX( |
| 57 gfx::AcceleratedWidget window, |
| 58 const gfx::SurfaceConfiguration& requested_configuration); |
| 56 | 59 |
| 57 // Implement GLSurfaceGLX. | 60 // Implement GLSurfaceGLX. |
| 58 bool Initialize() override; | 61 bool Initialize() override; |
| 59 void Destroy() override; | 62 void Destroy() override; |
| 60 bool Resize(const gfx::Size& size) override; | 63 bool Resize(const gfx::Size& size) override; |
| 61 bool IsOffscreen() override; | 64 bool IsOffscreen() override; |
| 62 bool SwapBuffers() override; | 65 bool SwapBuffers() override; |
| 63 gfx::Size GetSize() override; | 66 gfx::Size GetSize() override; |
| 64 void* GetHandle() override; | 67 void* GetHandle() override; |
| 65 bool SupportsPostSubBuffer() override; | 68 bool SupportsPostSubBuffer() override; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 88 gfx::Size size_; | 91 gfx::Size size_; |
| 89 | 92 |
| 90 scoped_ptr<VSyncProvider> vsync_provider_; | 93 scoped_ptr<VSyncProvider> vsync_provider_; |
| 91 | 94 |
| 92 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceGLX); | 95 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceGLX); |
| 93 }; | 96 }; |
| 94 | 97 |
| 95 // A surface used to render to an offscreen pbuffer. | 98 // A surface used to render to an offscreen pbuffer. |
| 96 class GL_EXPORT PbufferGLSurfaceGLX : public GLSurfaceGLX { | 99 class GL_EXPORT PbufferGLSurfaceGLX : public GLSurfaceGLX { |
| 97 public: | 100 public: |
| 98 explicit PbufferGLSurfaceGLX(const gfx::Size& size); | 101 PbufferGLSurfaceGLX( |
| 102 const gfx::Size& size, |
| 103 const gfx::SurfaceConfiguration& requested_configuration); |
| 99 | 104 |
| 100 // Implement GLSurfaceGLX. | 105 // Implement GLSurfaceGLX. |
| 101 bool Initialize() override; | 106 bool Initialize() override; |
| 102 void Destroy() override; | 107 void Destroy() override; |
| 103 bool IsOffscreen() override; | 108 bool IsOffscreen() override; |
| 104 bool SwapBuffers() override; | 109 bool SwapBuffers() override; |
| 105 gfx::Size GetSize() override; | 110 gfx::Size GetSize() override; |
| 106 void* GetHandle() override; | 111 void* GetHandle() override; |
| 107 void* GetConfig() override; | 112 void* GetConfig() override; |
| 108 | 113 |
| 109 protected: | 114 protected: |
| 110 ~PbufferGLSurfaceGLX() override; | 115 ~PbufferGLSurfaceGLX() override; |
| 111 | 116 |
| 112 private: | 117 private: |
| 113 gfx::Size size_; | 118 gfx::Size size_; |
| 114 void* config_; | 119 void* config_; |
| 115 XID pbuffer_; | 120 XID pbuffer_; |
| 116 | 121 |
| 117 DISALLOW_COPY_AND_ASSIGN(PbufferGLSurfaceGLX); | 122 DISALLOW_COPY_AND_ASSIGN(PbufferGLSurfaceGLX); |
| 118 }; | 123 }; |
| 119 | 124 |
| 120 } // namespace gfx | 125 } // namespace gfx |
| 121 | 126 |
| 122 #endif // UI_GL_GL_SURFACE_GLX_H_ | 127 #endif // UI_GL_GL_SURFACE_GLX_H_ |
| OLD | NEW |