Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: ui/gl/gl_surface_glx.h

Issue 2347383002: X11: Use better visuals for OpenGL (Closed)
Patch Set: auto* Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gl/gl_surface_egl.cc ('k') | ui/gl/gl_surface_glx.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <memory> 10 #include <memory>
(...skipping 28 matching lines...) Expand all
39 static bool IsCreateContextES2ProfileSupported(); 39 static bool IsCreateContextES2ProfileSupported();
40 static bool IsTextureFromPixmapSupported(); 40 static bool IsTextureFromPixmapSupported();
41 static bool IsOMLSyncControlSupported(); 41 static bool IsOMLSyncControlSupported();
42 42
43 void* GetDisplay() override; 43 void* GetDisplay() override;
44 44
45 // Get the FB config that the surface was created with or NULL if it is not 45 // Get the FB config that the surface was created with or NULL if it is not
46 // a GLX drawable. 46 // a GLX drawable.
47 void* GetConfig() override = 0; 47 void* GetConfig() override = 0;
48 48
49 unsigned long GetCompatibilityKey() override = 0;
50
49 protected: 51 protected:
50 ~GLSurfaceGLX() override; 52 ~GLSurfaceGLX() override;
51 53
52 private: 54 private:
53 DISALLOW_COPY_AND_ASSIGN(GLSurfaceGLX); 55 DISALLOW_COPY_AND_ASSIGN(GLSurfaceGLX);
54 }; 56 };
55 57
56 // A surface used to render to a view. 58 // A surface used to render to a view.
57 class GL_EXPORT NativeViewGLSurfaceGLX : public GLSurfaceGLX { 59 class GL_EXPORT NativeViewGLSurfaceGLX : public GLSurfaceGLX {
58 public: 60 public:
59 explicit NativeViewGLSurfaceGLX(gfx::AcceleratedWidget window); 61 explicit NativeViewGLSurfaceGLX(gfx::AcceleratedWidget window);
60 62
61 // Implement GLSurfaceGLX. 63 // Implement GLSurfaceGLX.
62 bool Initialize(GLSurface::Format format) override; 64 bool Initialize(GLSurface::Format format) override;
63 void Destroy() override; 65 void Destroy() override;
64 bool Resize(const gfx::Size& size, 66 bool Resize(const gfx::Size& size,
65 float scale_factor, 67 float scale_factor,
66 bool has_alpha) override; 68 bool has_alpha) override;
67 bool IsOffscreen() override; 69 bool IsOffscreen() override;
68 gfx::SwapResult SwapBuffers() override; 70 gfx::SwapResult SwapBuffers() override;
69 gfx::Size GetSize() override; 71 gfx::Size GetSize() override;
70 void* GetHandle() override; 72 void* GetHandle() override;
71 bool SupportsPostSubBuffer() override; 73 bool SupportsPostSubBuffer() override;
72 void* GetConfig() override; 74 void* GetConfig() override;
75 unsigned long GetCompatibilityKey() override;
73 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; 76 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override;
74 gfx::VSyncProvider* GetVSyncProvider() override; 77 gfx::VSyncProvider* GetVSyncProvider() override;
78 VisualID GetVisualID() const { return visual_id_; }
75 79
76 protected: 80 protected:
77 ~NativeViewGLSurfaceGLX() override; 81 ~NativeViewGLSurfaceGLX() override;
78 82
79 // Handle registering and unregistering for Expose events. 83 // Handle registering and unregistering for Expose events.
80 virtual void RegisterEvents() = 0; 84 virtual void RegisterEvents() = 0;
81 virtual void UnregisterEvents() = 0; 85 virtual void UnregisterEvents() = 0;
82 86
83 // Forwards Expose event to child window. 87 // Forwards Expose event to child window.
84 void ForwardExposeEvent(XEvent* xevent); 88 void ForwardExposeEvent(XEvent* xevent);
(...skipping 11 matching lines...) Expand all
96 gfx::AcceleratedWidget parent_window_; 100 gfx::AcceleratedWidget parent_window_;
97 101
98 // Child window, used to control resizes so that they're in-order with GL. 102 // Child window, used to control resizes so that they're in-order with GL.
99 gfx::AcceleratedWidget window_; 103 gfx::AcceleratedWidget window_;
100 104
101 // GLXDrawable for the window. 105 // GLXDrawable for the window.
102 GLXWindow glx_window_; 106 GLXWindow glx_window_;
103 107
104 GLXFBConfig config_; 108 GLXFBConfig config_;
105 gfx::Size size_; 109 gfx::Size size_;
110 VisualID visual_id_;
106 111
107 std::unique_ptr<gfx::VSyncProvider> vsync_provider_; 112 std::unique_ptr<gfx::VSyncProvider> vsync_provider_;
108 113
109 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceGLX); 114 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceGLX);
110 }; 115 };
111 116
112 // A surface used to render to an offscreen pbuffer. 117 // A surface used to render to an offscreen pbuffer.
113 class GL_EXPORT UnmappedNativeViewGLSurfaceGLX : public GLSurfaceGLX { 118 class GL_EXPORT UnmappedNativeViewGLSurfaceGLX : public GLSurfaceGLX {
114 public: 119 public:
115 explicit UnmappedNativeViewGLSurfaceGLX(const gfx::Size& size); 120 explicit UnmappedNativeViewGLSurfaceGLX(const gfx::Size& size);
116 121
117 // Implement GLSurfaceGLX. 122 // Implement GLSurfaceGLX.
118 bool Initialize(GLSurface::Format format) override; 123 bool Initialize(GLSurface::Format format) override;
119 void Destroy() override; 124 void Destroy() override;
120 bool IsOffscreen() override; 125 bool IsOffscreen() override;
121 gfx::SwapResult SwapBuffers() override; 126 gfx::SwapResult SwapBuffers() override;
122 gfx::Size GetSize() override; 127 gfx::Size GetSize() override;
123 void* GetHandle() override; 128 void* GetHandle() override;
124 void* GetConfig() override; 129 void* GetConfig() override;
130 unsigned long GetCompatibilityKey() override;
125 131
126 protected: 132 protected:
127 ~UnmappedNativeViewGLSurfaceGLX() override; 133 ~UnmappedNativeViewGLSurfaceGLX() override;
128 134
129 private: 135 private:
130 gfx::Size size_; 136 gfx::Size size_;
131 GLXFBConfig config_; 137 GLXFBConfig config_;
132 // Unmapped dummy window, used to provide a compatible surface. 138 // Unmapped dummy window, used to provide a compatible surface.
133 gfx::AcceleratedWidget window_; 139 gfx::AcceleratedWidget window_;
134 140
135 // GLXDrawable for the window. 141 // GLXDrawable for the window.
136 GLXWindow glx_window_; 142 GLXWindow glx_window_;
137 143
138 DISALLOW_COPY_AND_ASSIGN(UnmappedNativeViewGLSurfaceGLX); 144 DISALLOW_COPY_AND_ASSIGN(UnmappedNativeViewGLSurfaceGLX);
139 }; 145 };
140 146
141 } // namespace gl 147 } // namespace gl
142 148
143 #endif // UI_GL_GL_SURFACE_GLX_H_ 149 #endif // UI_GL_GL_SURFACE_GLX_H_
OLDNEW
« no previous file with comments | « ui/gl/gl_surface_egl.cc ('k') | ui/gl/gl_surface_glx.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698