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

Side by Side Diff: ui/gl/gl_visual_picker_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_glx.cc ('k') | ui/gl/gl_visual_picker_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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef UI_GL_GL_VISUAL_PICKER_GLX_H_
6 #define UI_GL_GL_VISUAL_PICKER_GLX_H_
7
8 #include <X11/Xutil.h>
9
10 #include <vector>
11
12 #include "base/macros.h"
13 #include "ui/gfx/x/x11_types.h"
14 #include "ui/gl/gl_export.h"
15
16 namespace base {
17 template <typename T>
18 struct DefaultSingletonTraits;
19 }
20
21 namespace gl {
22
23 // Picks the best X11 visuals to use for GL. This class is adapted from GTK's
24 // pick_better_visual_for_gl. Tries to find visuals that
25 // 1. Support GL
26 // 2. Support double buffer
27 // 3. Have an alpha channel only if we want one
28 class GL_EXPORT GLVisualPickerGLX {
29 public:
30 static GLVisualPickerGLX* GetInstance();
31
32 ~GLVisualPickerGLX();
33
34 const XVisualInfo& system_visual() { return system_visual_; };
35
36 const XVisualInfo& rgba_visual() { return rgba_visual_; };
37
38 private:
39 friend struct base::DefaultSingletonTraits<GLVisualPickerGLX>;
40
41 XVisualInfo PickBestGlVisual(const std::vector<XVisualInfo>& visuals,
42 bool want_alpha) const;
43
44 XVisualInfo PickBestSystemVisual(
45 const std::vector<XVisualInfo>& visuals) const;
46
47 XVisualInfo PickBestRgbaVisual(const std::vector<XVisualInfo>& visuals) const;
48
49 XDisplay* display_;
50
51 bool has_glx_visual_rating_;
52 bool has_glx_multisample_;
53
54 XVisualInfo system_visual_;
55 XVisualInfo rgba_visual_;
56
57 GLVisualPickerGLX();
58
59 DISALLOW_COPY_AND_ASSIGN(GLVisualPickerGLX);
60 };
61
62 } // namespace gl
63
64 #endif // UI_GL_GL_VISUAL_PICKER_GLX_H_
OLDNEW
« no previous file with comments | « ui/gl/gl_surface_glx.cc ('k') | ui/gl/gl_visual_picker_glx.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698