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

Unified Diff: ui/gl/gl_surface_egl.cc

Issue 2347383002: X11: Use better visuals for OpenGL (Closed)
Patch Set: auto* Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gl/gl_surface.cc ('k') | ui/gl/gl_surface_glx.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_surface_egl.cc
diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc
index 3db87e59f622ff45c9740e930c8a11d1bd3c8521..ed6a4d901b37c424f9585cfc37c3564079059774 100644
--- a/ui/gl/gl_surface_egl.cc
+++ b/ui/gl/gl_surface_egl.cc
@@ -31,16 +31,16 @@
#include "ui/gl/scoped_make_current.h"
#include "ui/gl/sync_control_vsync_provider.h"
-#if defined(OS_ANDROID)
-#include <android/native_window_jni.h>
-#endif
-
#if defined(USE_X11) && !defined(OS_CHROMEOS)
extern "C" {
#include <X11/Xlib.h>
#define Status int
}
-#include "ui/gfx/x/x11_switches.h" // nogncheck
+#include "ui/base/x/x11_util_internal.h" // nogncheck
+#endif
+
+#if defined(OS_ANDROID)
+#include <android/native_window_jni.h>
#endif
#if !defined(EGL_FIXED_SIZE_ANGLE)
@@ -177,14 +177,11 @@ EGLDisplay GetPlatformANGLEDisplay(EGLNativeDisplayType native_display,
}
#if defined(USE_X11) && !defined(OS_CHROMEOS)
- std::string visualid_str =
- base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
- switches::kX11VisualID);
- unsigned int visualid = 0;
- bool succeed = base::StringToUint(visualid_str, &visualid);
- DCHECK(succeed);
+ Visual* visual;
+ ui::XVisualManager::GetInstance()->ChooseVisualForWindow(
+ true, &visual, nullptr, nullptr, nullptr);
display_attribs.push_back(EGL_X11_VISUAL_ID_ANGLE);
- display_attribs.push_back((EGLint)visualid);
+ display_attribs.push_back(static_cast<EGLint>(XVisualIDFromVisual(visual)));
#endif
display_attribs.push_back(EGL_NONE);
@@ -270,17 +267,9 @@ EGLConfig ChooseConfig(GLSurface::Format format) {
EGLint alpha_size = 8;
#if defined(USE_X11) && !defined(OS_CHROMEOS)
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kWindowDepth)) {
- std::string depth =
- base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
- switches::kWindowDepth);
-
- bool succeed = base::StringToInt(depth, &buffer_size);
- DCHECK(succeed);
-
- alpha_size = buffer_size == 32 ? 8 : 0;
- }
+ ui::XVisualManager::GetInstance()->ChooseVisualForWindow(
+ true, nullptr, &buffer_size, nullptr, nullptr);
+ alpha_size = buffer_size == 32 ? 8 : 0;
#endif
EGLint surface_type = (format == GLSurface::SURFACE_SURFACELESS)
« no previous file with comments | « ui/gl/gl_surface.cc ('k') | ui/gl/gl_surface_glx.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698