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

Unified Diff: ui/gl/gl_surface_win.cc

Issue 196403008: gl: Move platform-specific EGL code into separate files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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_win.cc
diff --git a/ui/gl/gl_surface_win.cc b/ui/gl/gl_surface_win.cc
index 7540b1fc35d6125c14f3aef83327cd83bbfe37cc..60f0acde2eaaf31fd65afe1c684ab72ac0ae3600 100644
--- a/ui/gl/gl_surface_win.cc
+++ b/ui/gl/gl_surface_win.cc
@@ -20,8 +20,26 @@
#include "ui/gl/gl_surface_stub.h"
#include "ui/gl/gl_surface_wgl.h"
+// From ANGLE's egl/eglext.h.
+#if !defined(EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE)
+#define EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE \
+ reinterpret_cast<EGLNativeDisplayType>(-2)
+#endif
+
namespace gfx {
+namespace {
+
+EGLNativeDisplayType GetEGLDisplay() {
+ EGLNativeDisplayType_native_display = EGL_DEFAULT_DISPLAY;
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableD3D11) &&
+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableD3D11)) {
+ native_display = EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE;
+ }
+
+ return native_display;
+}
+
// This OSMesa GL surface can use GDI to swap the contents of the buffer to a
// view.
class NativeViewGLSurfaceOSMesa : public GLSurfaceOSMesa {
@@ -94,7 +112,7 @@ bool GLSurface::InitializeOneOffInternal() {
}
break;
case kGLImplementationEGLGLES2:
- if (!GLSurfaceEGL::InitializeOneOff()) {
+ if (!GLSurfaceEGL::InitializeOneOff(GetEGLDisplay())) {
LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed.";
return false;
}

Powered by Google App Engine
This is Rietveld 408576698