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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 } // namespace | 91 } // namespace |
92 | 92 |
93 GLSurfaceEGL::GLSurfaceEGL() {} | 93 GLSurfaceEGL::GLSurfaceEGL() {} |
94 | 94 |
95 bool GLSurfaceEGL::InitializeOneOff() { | 95 bool GLSurfaceEGL::InitializeOneOff() { |
96 static bool initialized = false; | 96 static bool initialized = false; |
97 if (initialized) | 97 if (initialized) |
98 return true; | 98 return true; |
99 | 99 |
100 g_native_display = GetPlatformDefaultEGLNativeDisplay(); | 100 g_native_display = GetPlatformDefaultEGLNativeDisplay(); |
| 101 |
| 102 #if defined(OS_WIN) |
| 103 const EGLenum platform = GetPlatformDefaultEGLNativePlatform(); |
| 104 const EGLint* attributes = GetPlatformDefaultEGLNativeDisplayAttributes(); |
| 105 g_display = eglGetPlatformDisplayEXT(platform, g_native_display, attributes); |
| 106 #else |
101 g_display = eglGetDisplay(g_native_display); | 107 g_display = eglGetDisplay(g_native_display); |
| 108 #endif |
102 if (!g_display) { | 109 if (!g_display) { |
103 LOG(ERROR) << "eglGetDisplay failed with error " << GetLastEGLErrorString(); | 110 LOG(ERROR) << "eglGetDisplay failed with error " << GetLastEGLErrorString(); |
104 return false; | 111 return false; |
105 } | 112 } |
106 | 113 |
107 if (!eglInitialize(g_display, NULL, NULL)) { | 114 if (!eglInitialize(g_display, NULL, NULL)) { |
108 LOG(ERROR) << "eglInitialize failed with error " << GetLastEGLErrorString(); | 115 LOG(ERROR) << "eglInitialize failed with error " << GetLastEGLErrorString(); |
109 return false; | 116 return false; |
110 } | 117 } |
111 | 118 |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 } | 655 } |
649 | 656 |
650 void* SurfacelessEGL::GetShareHandle() { | 657 void* SurfacelessEGL::GetShareHandle() { |
651 return NULL; | 658 return NULL; |
652 } | 659 } |
653 | 660 |
654 SurfacelessEGL::~SurfacelessEGL() { | 661 SurfacelessEGL::~SurfacelessEGL() { |
655 } | 662 } |
656 | 663 |
657 } // namespace gfx | 664 } // namespace gfx |
OLD | NEW |