Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "ui/gl/gl_surface_egl.h" | 5 #include "ui/gl/gl_surface_egl.h" |
| 6 | 6 |
| 7 #if defined(OS_ANDROID) | 7 #if defined(OS_ANDROID) |
| 8 #include <android/native_window_jni.h> | 8 #include <android/native_window_jni.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 extern "C" { | 28 extern "C" { |
| 29 #include <X11/Xlib.h> | 29 #include <X11/Xlib.h> |
| 30 } | 30 } |
| 31 #endif | 31 #endif |
| 32 | 32 |
| 33 #if defined (USE_OZONE) | 33 #if defined (USE_OZONE) |
| 34 #include "ui/ozone/public/ozone_platform.h" | 34 #include "ui/ozone/public/ozone_platform.h" |
| 35 #include "ui/ozone/public/surface_factory_ozone.h" | 35 #include "ui/ozone/public/surface_factory_ozone.h" |
| 36 #endif | 36 #endif |
| 37 | 37 |
| 38 #if defined(USE_X11) && !defined(OS_CHROMEOS) | |
| 39 #include "ui/gfx/x/x11_switches.h" | |
| 40 #endif | |
| 41 | |
| 38 #if !defined(EGL_FIXED_SIZE_ANGLE) | 42 #if !defined(EGL_FIXED_SIZE_ANGLE) |
| 39 #define EGL_FIXED_SIZE_ANGLE 0x3201 | 43 #define EGL_FIXED_SIZE_ANGLE 0x3201 |
| 40 #endif | 44 #endif |
| 41 | 45 |
| 42 #if !defined(EGL_OPENGL_ES3_BIT) | 46 #if !defined(EGL_OPENGL_ES3_BIT) |
| 43 #define EGL_OPENGL_ES3_BIT 0x00000040 | 47 #define EGL_OPENGL_ES3_BIT 0x00000040 |
| 44 #endif | 48 #endif |
| 45 | 49 |
| 46 // From ANGLE's egl/eglext.h. | 50 // From ANGLE's egl/eglext.h. |
| 47 | 51 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 266 if (g_display == EGL_NO_DISPLAY) | 270 if (g_display == EGL_NO_DISPLAY) |
| 267 return false; | 271 return false; |
| 268 | 272 |
| 269 // Choose an EGL configuration. | 273 // Choose an EGL configuration. |
| 270 // On X this is only used for PBuffer surfaces. | 274 // On X this is only used for PBuffer surfaces. |
| 271 EGLint renderable_type = EGL_OPENGL_ES2_BIT; | 275 EGLint renderable_type = EGL_OPENGL_ES2_BIT; |
| 272 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 276 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 273 switches::kEnableUnsafeES3APIs)) { | 277 switches::kEnableUnsafeES3APIs)) { |
| 274 renderable_type = EGL_OPENGL_ES3_BIT; | 278 renderable_type = EGL_OPENGL_ES3_BIT; |
| 275 } | 279 } |
| 280 | |
| 281 EGLint buffer_size = 32; | |
| 282 EGLint alpha_size = 8; | |
| 283 | |
| 284 #if defined(USE_X11) && !defined(OS_CHROMEOS) | |
| 285 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 286 switches::kEnableTransparentVisuals)) { | |
|
piman
2015/11/17 20:53:52
I would prefer if we didn't rely on behavior of th
| |
| 287 buffer_size = 24; | |
| 288 alpha_size = 0; | |
| 289 } | |
| 290 #endif | |
| 291 | |
| 276 const EGLint kConfigAttribs[] = { | 292 const EGLint kConfigAttribs[] = { |
| 277 EGL_BUFFER_SIZE, 32, | 293 EGL_BUFFER_SIZE, buffer_size, |
| 278 EGL_ALPHA_SIZE, 8, | 294 EGL_ALPHA_SIZE, alpha_size, |
| 279 EGL_BLUE_SIZE, 8, | 295 EGL_BLUE_SIZE, 8, |
| 280 EGL_GREEN_SIZE, 8, | 296 EGL_GREEN_SIZE, 8, |
| 281 EGL_RED_SIZE, 8, | 297 EGL_RED_SIZE, 8, |
| 282 EGL_RENDERABLE_TYPE, renderable_type, | 298 EGL_RENDERABLE_TYPE, renderable_type, |
| 283 EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT, | 299 EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT, |
| 284 EGL_NONE | 300 EGL_NONE |
| 285 }; | 301 }; |
| 286 | 302 |
| 287 #if defined(USE_OZONE) | 303 #if defined(USE_OZONE) |
| 288 const EGLint* config_attribs = ui::OzonePlatform::GetInstance() | 304 const EGLint* config_attribs = ui::OzonePlatform::GetInstance() |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 914 } | 930 } |
| 915 | 931 |
| 916 void* SurfacelessEGL::GetShareHandle() { | 932 void* SurfacelessEGL::GetShareHandle() { |
| 917 return NULL; | 933 return NULL; |
| 918 } | 934 } |
| 919 | 935 |
| 920 SurfacelessEGL::~SurfacelessEGL() { | 936 SurfacelessEGL::~SurfacelessEGL() { |
| 921 } | 937 } |
| 922 | 938 |
| 923 } // namespace gfx | 939 } // namespace gfx |
| OLD | NEW |