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

Unified Diff: ui/gl/gl_surface_egl.cc

Issue 2347383002: X11: Use better visuals for OpenGL (Closed)
Patch Set: Fix --single-process 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
Index: ui/gl/gl_surface_egl.cc
diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc
index 9fb5082ebcf33221d19fc2785222294c8de13141..6415a635ecc1611163ba99616f5ab8c2adbea159 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)
@@ -175,14 +175,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);
Julien Isorce Samsung 2016/09/28 17:42:51 This assumes that the returned visual is the same
Tom (Use chromium acct) 2016/09/28 18:36:01 Yes
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);
@@ -274,17 +271,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)

Powered by Google App Engine
This is Rietveld 408576698