OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "gl/GrGLInterface.h" | 10 #include "gl/GrGLInterface.h" |
11 #include "gl/GrGLAssembleInterface.h" | 11 #include "gl/GrGLAssembleInterface.h" |
12 | 12 |
13 #define WIN32_LEAN_AND_MEAN | 13 #define WIN32_LEAN_AND_MEAN |
14 #include <windows.h> | 14 #include <windows.h> |
15 #include "EGL/egl.h" | 15 #include "EGL/egl.h" |
16 | 16 |
17 static GrGLFuncPtr angle_get_gl_proc(void* ctx, const char name[]) { | 17 static GrGLFuncPtr angle_get_gl_proc(void* ctx, const char name[]) { |
18 GrGLFuncPtr proc = (GrGLFuncPtr) GetProcAddress((HMODULE)ctx, name); | 18 GrGLFuncPtr proc = (GrGLFuncPtr) GetProcAddress((HMODULE)ctx, name); |
19 if (proc) { | 19 if (proc) { |
20 return proc; | 20 return proc; |
21 } | 21 } |
22 return eglGetProcAddress(name); | 22 return eglGetProcAddress(name); |
23 } | 23 } |
24 | 24 |
25 const GrGLInterface* GrGLCreateANGLEInterface() { | 25 const GrGLInterface* GrGLCreateANGLEInterface() { |
26 | 26 |
27 static HMODULE ghANGLELib = NULL; | 27 static HMODULE ghANGLELib = nullptr; |
28 | 28 |
29 if (NULL == ghANGLELib) { | 29 if (nullptr == ghANGLELib) { |
30 // We load the ANGLE library and never let it go | 30 // We load the ANGLE library and never let it go |
31 ghANGLELib = LoadLibrary("libGLESv2.dll"); | 31 ghANGLELib = LoadLibrary("libGLESv2.dll"); |
32 } | 32 } |
33 if (NULL == ghANGLELib) { | 33 if (nullptr == ghANGLELib) { |
34 // We can't setup the interface correctly w/o the DLL | 34 // We can't setup the interface correctly w/o the DLL |
35 return NULL; | 35 return nullptr; |
36 } | 36 } |
37 | 37 |
38 return GrGLAssembleGLESInterface(ghANGLELib, angle_get_gl_proc); | 38 return GrGLAssembleGLESInterface(ghANGLELib, angle_get_gl_proc); |
39 } | 39 } |
OLD | NEW |