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

Unified Diff: ui/gl/gl_surface_egl.cc

Issue 1429083002: gl_surface_egl: ensure off and on screen surfaces use the same EGLConfig (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/gfx/x/x11_switches.cc ('k') | ui/views/views_switches.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 7c36984843a7eadbf12da2bf7c3ec969542a492e..677c356411ab625276a7b44bcf13e395d5e8da2f 100644
--- a/ui/gl/gl_surface_egl.cc
+++ b/ui/gl/gl_surface_egl.cc
@@ -13,6 +13,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram_macros.h"
+#include "base/strings/string_number_conversions.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "ui/gfx/geometry/rect.h"
@@ -35,6 +36,10 @@ extern "C" {
#include "ui/ozone/public/surface_factory_ozone.h"
#endif
+#if defined(USE_X11) && !defined(OS_CHROMEOS)
+#include "ui/gfx/x/x11_switches.h"
+#endif
+
#if !defined(EGL_FIXED_SIZE_ANGLE)
#define EGL_FIXED_SIZE_ANGLE 0x3201
#endif
@@ -273,9 +278,27 @@ bool GLSurfaceEGL::InitializeOneOff() {
switches::kEnableUnsafeES3APIs)) {
renderable_type = EGL_OPENGL_ES3_BIT;
}
+
+ EGLint buffer_size = 32;
+ 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;
+ }
+#endif
+
const EGLint kConfigAttribs[] = {
- EGL_BUFFER_SIZE, 32,
- EGL_ALPHA_SIZE, 8,
+ EGL_BUFFER_SIZE, buffer_size,
+ EGL_ALPHA_SIZE, alpha_size,
EGL_BLUE_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_RED_SIZE, 8,
« no previous file with comments | « ui/gfx/x/x11_switches.cc ('k') | ui/views/views_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698