| 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/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
| 12 #include "ui/gfx/size.h" | 13 #include "ui/gfx/size.h" |
| 13 #include "ui/gfx/vsync_provider.h" | 14 #include "ui/gfx/vsync_provider.h" |
| 14 #include "ui/gfx/x/x11_types.h" | 15 #include "ui/gfx/x/x11_types.h" |
| 15 #include "ui/gl/gl_export.h" | 16 #include "ui/gl/gl_export.h" |
| 16 #include "ui/gl/gl_surface.h" | 17 #include "ui/gl/gl_surface.h" |
| 17 | 18 |
| 18 namespace gfx { | 19 namespace gfx { |
| 19 | 20 |
| 20 // Base class for GLX surfaces. | 21 // Base class for GLX surfaces. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 41 virtual void* GetConfig() = 0; | 42 virtual void* GetConfig() = 0; |
| 42 | 43 |
| 43 protected: | 44 protected: |
| 44 virtual ~GLSurfaceGLX(); | 45 virtual ~GLSurfaceGLX(); |
| 45 | 46 |
| 46 private: | 47 private: |
| 47 DISALLOW_COPY_AND_ASSIGN(GLSurfaceGLX); | 48 DISALLOW_COPY_AND_ASSIGN(GLSurfaceGLX); |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 // A surface used to render to a view. | 51 // A surface used to render to a view. |
| 51 class GL_EXPORT NativeViewGLSurfaceGLX : public GLSurfaceGLX { | 52 class GL_EXPORT NativeViewGLSurfaceGLX : public GLSurfaceGLX, |
| 53 public ui::PlatformEventDispatcher { |
| 52 public: | 54 public: |
| 53 explicit NativeViewGLSurfaceGLX(gfx::AcceleratedWidget window); | 55 explicit NativeViewGLSurfaceGLX(gfx::AcceleratedWidget window); |
| 54 | 56 |
| 55 // Implement GLSurfaceGLX. | 57 // Implement GLSurfaceGLX. |
| 56 virtual bool Initialize() OVERRIDE; | 58 virtual bool Initialize() OVERRIDE; |
| 57 virtual void Destroy() OVERRIDE; | 59 virtual void Destroy() OVERRIDE; |
| 58 virtual bool Resize(const gfx::Size& size) OVERRIDE; | 60 virtual bool Resize(const gfx::Size& size) OVERRIDE; |
| 59 virtual bool IsOffscreen() OVERRIDE; | 61 virtual bool IsOffscreen() OVERRIDE; |
| 60 virtual bool SwapBuffers() OVERRIDE; | 62 virtual bool SwapBuffers() OVERRIDE; |
| 61 virtual gfx::Size GetSize() OVERRIDE; | 63 virtual gfx::Size GetSize() OVERRIDE; |
| 62 virtual void* GetHandle() OVERRIDE; | 64 virtual void* GetHandle() OVERRIDE; |
| 63 virtual bool SupportsPostSubBuffer() OVERRIDE; | 65 virtual bool SupportsPostSubBuffer() OVERRIDE; |
| 64 virtual void* GetConfig() OVERRIDE; | 66 virtual void* GetConfig() OVERRIDE; |
| 65 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 67 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
| 66 virtual VSyncProvider* GetVSyncProvider() OVERRIDE; | 68 virtual VSyncProvider* GetVSyncProvider() OVERRIDE; |
| 67 | 69 |
| 68 protected: | 70 protected: |
| 69 NativeViewGLSurfaceGLX(); | |
| 70 virtual ~NativeViewGLSurfaceGLX(); | 71 virtual ~NativeViewGLSurfaceGLX(); |
| 71 | 72 |
| 72 private: | 73 private: |
| 73 // The handle for the drawable to make current or swap. | 74 // The handle for the drawable to make current or swap. |
| 74 gfx::AcceleratedWidget GetDrawableHandle() const; | 75 gfx::AcceleratedWidget GetDrawableHandle() const; |
| 75 | 76 |
| 77 // PlatformEventDispatcher implementation |
| 78 virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE; |
| 79 virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE; |
| 80 |
| 76 // Window passed in at creation. Always valid. | 81 // Window passed in at creation. Always valid. |
| 77 gfx::AcceleratedWidget parent_window_; | 82 gfx::AcceleratedWidget parent_window_; |
| 78 | 83 |
| 79 // Child window, used to control resizes so that they're in-order with GL. | 84 // Child window, used to control resizes so that they're in-order with GL. |
| 80 gfx::AcceleratedWidget window_; | 85 gfx::AcceleratedWidget window_; |
| 81 | 86 |
| 82 void* config_; | 87 void* config_; |
| 83 gfx::Size size_; | 88 gfx::Size size_; |
| 84 | 89 |
| 85 scoped_ptr<VSyncProvider> vsync_provider_; | 90 scoped_ptr<VSyncProvider> vsync_provider_; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 108 gfx::Size size_; | 113 gfx::Size size_; |
| 109 void* config_; | 114 void* config_; |
| 110 XID pbuffer_; | 115 XID pbuffer_; |
| 111 | 116 |
| 112 DISALLOW_COPY_AND_ASSIGN(PbufferGLSurfaceGLX); | 117 DISALLOW_COPY_AND_ASSIGN(PbufferGLSurfaceGLX); |
| 113 }; | 118 }; |
| 114 | 119 |
| 115 } // namespace gfx | 120 } // namespace gfx |
| 116 | 121 |
| 117 #endif // UI_GL_GL_SURFACE_GLX_H_ | 122 #endif // UI_GL_GL_SURFACE_GLX_H_ |
| OLD | NEW |