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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
281 EGL_RED_SIZE, 8, | 285 EGL_RED_SIZE, 8, |
282 EGL_RENDERABLE_TYPE, renderable_type, | 286 EGL_RENDERABLE_TYPE, renderable_type, |
283 EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT, | 287 EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT, |
284 EGL_NONE | 288 EGL_NONE |
285 }; | 289 }; |
286 | 290 |
287 #if defined(USE_OZONE) | 291 #if defined(USE_OZONE) |
288 const EGLint* config_attribs = ui::OzonePlatform::GetInstance() | 292 const EGLint* config_attribs = ui::OzonePlatform::GetInstance() |
289 ->GetSurfaceFactoryOzone() | 293 ->GetSurfaceFactoryOzone() |
290 ->GetEGLSurfaceProperties(kConfigAttribs); | 294 ->GetEGLSurfaceProperties(kConfigAttribs); |
295 #elif defined(USE_X11) && !defined(OS_CHROMEOS) | |
296 const EGLint* config_attribs = kConfigAttribs; | |
297 | |
298 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | |
299 switches::kEnableTransparentVisuals)) { | |
300 const int kBufferSizeOffset = 1; | |
301 const int kAlphaSizeOffset = 3; | |
302 EGLint* config_non_const = const_cast<EGLint*>(kConfigAttribs); | |
hendrikw
2015/11/11 23:55:46
Not a big fan of this const stuff.
How about abov
Julien Isorce Samsung
2015/11/12 11:06:48
Much easier to read indeed, thx. I addressed remar
| |
303 | |
304 config_non_const[kBufferSizeOffset] = 24; | |
305 config_non_const[kAlphaSizeOffset] = 0; | |
306 | |
307 config_attribs = config_non_const; | |
308 } | |
291 #else | 309 #else |
292 const EGLint* config_attribs = kConfigAttribs; | 310 const EGLint* config_attribs = kConfigAttribs; |
293 #endif | 311 #endif |
294 | 312 |
295 EGLint num_configs; | 313 EGLint num_configs; |
296 if (!eglChooseConfig(g_display, | 314 if (!eglChooseConfig(g_display, |
297 config_attribs, | 315 config_attribs, |
298 NULL, | 316 NULL, |
299 0, | 317 0, |
300 &num_configs)) { | 318 &num_configs)) { |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
914 } | 932 } |
915 | 933 |
916 void* SurfacelessEGL::GetShareHandle() { | 934 void* SurfacelessEGL::GetShareHandle() { |
917 return NULL; | 935 return NULL; |
918 } | 936 } |
919 | 937 |
920 SurfacelessEGL::~SurfacelessEGL() { | 938 SurfacelessEGL::~SurfacelessEGL() { |
921 } | 939 } |
922 | 940 |
923 } // namespace gfx | 941 } // namespace gfx |
OLD | NEW |