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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "ui/events/platform/platform_event_dispatcher.h" | 14 #include "ui/events/platform/platform_event_dispatcher.h" |
15 #include "ui/gfx/geometry/size.h" | 15 #include "ui/gfx/geometry/size.h" |
16 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
17 #include "ui/gfx/vsync_provider.h" | 17 #include "ui/gfx/vsync_provider.h" |
18 #include "ui/gfx/x/x11_types.h" | 18 #include "ui/gfx/x/x11_types.h" |
19 #include "ui/gl/gl_export.h" | 19 #include "ui/gl/gl_export.h" |
20 #include "ui/gl/gl_surface.h" | 20 #include "ui/gl/gl_surface.h" |
21 | 21 |
22 namespace gfx { | 22 namespace gl { |
23 | 23 |
24 // Base class for GLX surfaces. | 24 // Base class for GLX surfaces. |
25 class GL_EXPORT GLSurfaceGLX : public GLSurface { | 25 class GL_EXPORT GLSurfaceGLX : public GLSurface { |
26 public: | 26 public: |
27 GLSurfaceGLX(); | 27 GLSurfaceGLX(); |
28 | 28 |
29 static bool InitializeOneOff(); | 29 static bool InitializeOneOff(); |
30 | 30 |
31 // These aren't particularly tied to surfaces, but since we already | 31 // These aren't particularly tied to surfaces, but since we already |
32 // have the static InitializeOneOff here, it's easiest to reuse its | 32 // have the static InitializeOneOff here, it's easiest to reuse its |
(...skipping 30 matching lines...) Expand all Loading... |
63 bool Resize(const gfx::Size& size, | 63 bool Resize(const gfx::Size& size, |
64 float scale_factor, | 64 float scale_factor, |
65 bool has_alpha) override; | 65 bool has_alpha) override; |
66 bool IsOffscreen() override; | 66 bool IsOffscreen() override; |
67 gfx::SwapResult SwapBuffers() override; | 67 gfx::SwapResult SwapBuffers() override; |
68 gfx::Size GetSize() override; | 68 gfx::Size GetSize() override; |
69 void* GetHandle() override; | 69 void* GetHandle() override; |
70 bool SupportsPostSubBuffer() override; | 70 bool SupportsPostSubBuffer() override; |
71 void* GetConfig() override; | 71 void* GetConfig() override; |
72 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; | 72 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; |
73 VSyncProvider* GetVSyncProvider() override; | 73 gfx::VSyncProvider* GetVSyncProvider() override; |
74 | 74 |
75 protected: | 75 protected: |
76 ~NativeViewGLSurfaceGLX() override; | 76 ~NativeViewGLSurfaceGLX() override; |
77 | 77 |
78 private: | 78 private: |
79 // The handle for the drawable to make current or swap. | 79 // The handle for the drawable to make current or swap. |
80 GLXDrawable GetDrawableHandle() const; | 80 GLXDrawable GetDrawableHandle() const; |
81 | 81 |
82 // PlatformEventDispatcher implementation | 82 // PlatformEventDispatcher implementation |
83 bool CanDispatchEvent(const ui::PlatformEvent& event) override; | 83 bool CanDispatchEvent(const ui::PlatformEvent& event) override; |
84 uint32_t DispatchEvent(const ui::PlatformEvent& event) override; | 84 uint32_t DispatchEvent(const ui::PlatformEvent& event) override; |
85 | 85 |
86 // Window passed in at creation. Always valid. | 86 // Window passed in at creation. Always valid. |
87 gfx::AcceleratedWidget parent_window_; | 87 gfx::AcceleratedWidget parent_window_; |
88 | 88 |
89 // Child window, used to control resizes so that they're in-order with GL. | 89 // Child window, used to control resizes so that they're in-order with GL. |
90 gfx::AcceleratedWidget window_; | 90 gfx::AcceleratedWidget window_; |
91 | 91 |
92 // GLXDrawable for the window. | 92 // GLXDrawable for the window. |
93 GLXWindow glx_window_; | 93 GLXWindow glx_window_; |
94 | 94 |
95 GLXFBConfig config_; | 95 GLXFBConfig config_; |
96 gfx::Size size_; | 96 gfx::Size size_; |
97 | 97 |
98 std::unique_ptr<VSyncProvider> vsync_provider_; | 98 std::unique_ptr<gfx::VSyncProvider> vsync_provider_; |
99 | 99 |
100 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceGLX); | 100 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceGLX); |
101 }; | 101 }; |
102 | 102 |
103 // A surface used to render to an offscreen pbuffer. | 103 // A surface used to render to an offscreen pbuffer. |
104 class GL_EXPORT UnmappedNativeViewGLSurfaceGLX : public GLSurfaceGLX { | 104 class GL_EXPORT UnmappedNativeViewGLSurfaceGLX : public GLSurfaceGLX { |
105 public: | 105 public: |
106 explicit UnmappedNativeViewGLSurfaceGLX(const gfx::Size& size); | 106 explicit UnmappedNativeViewGLSurfaceGLX(const gfx::Size& size); |
107 | 107 |
108 // Implement GLSurfaceGLX. | 108 // Implement GLSurfaceGLX. |
(...skipping 13 matching lines...) Expand all Loading... |
122 GLXFBConfig config_; | 122 GLXFBConfig config_; |
123 // Unmapped dummy window, used to provide a compatible surface. | 123 // Unmapped dummy window, used to provide a compatible surface. |
124 gfx::AcceleratedWidget window_; | 124 gfx::AcceleratedWidget window_; |
125 | 125 |
126 // GLXDrawable for the window. | 126 // GLXDrawable for the window. |
127 GLXWindow glx_window_; | 127 GLXWindow glx_window_; |
128 | 128 |
129 DISALLOW_COPY_AND_ASSIGN(UnmappedNativeViewGLSurfaceGLX); | 129 DISALLOW_COPY_AND_ASSIGN(UnmappedNativeViewGLSurfaceGLX); |
130 }; | 130 }; |
131 | 131 |
132 } // namespace gfx | 132 } // namespace gl |
133 | 133 |
134 #endif // UI_GL_GL_SURFACE_GLX_H_ | 134 #endif // UI_GL_GL_SURFACE_GLX_H_ |
OLD | NEW |