| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 #include "gl/GrGLInterface.h" | 9 #include "gl/GrGLInterface.h" |
| 10 #include "gl/GrGLUtil.h" | 10 #include "gl/GrGLUtil.h" |
| 11 #define WIN32_LEAN_AND_MEAN | 11 #define WIN32_LEAN_AND_MEAN |
| 12 #include <windows.h> | 12 #include <windows.h> |
| 13 | 13 |
| 14 /* | 14 /* |
| 15 * Windows makes the GL funcs all be __stdcall instead of __cdecl :( | 15 * Windows makes the GL funcs all be __stdcall instead of __cdecl :( |
| 16 * This implementation will only work if GR_GL_FUNCTION_TYPE is __stdcall. | 16 * This implementation will only work if GR_GL_FUNCTION_TYPE is __stdcall. |
| 17 * Otherwise, a springboard would be needed that hides the calling convention. | 17 * Otherwise, a springboard would be needed that hides the calling convention. |
| 18 */ | 18 */ |
| 19 | 19 |
| 20 #define SET_PROC(F) interface->f ## F = (GrGL ## F ## Proc) GetProcAddress(alu.g
et(), "gl" #F); | 20 #define SET_PROC(F) interface->fFunctions.f ## F = (GrGL ## F ## Proc) GetProcAd
dress(alu.get(), "gl" #F); |
| 21 #define WGL_SET_PROC(F) interface->f ## F = (GrGL ## F ## Proc) wglGetProcAddres
s("gl" #F); | 21 #define WGL_SET_PROC(F) interface->fFunctions.f ## F = (GrGL ## F ## Proc) wglGe
tProcAddress("gl" #F); |
| 22 #define WGL_SET_PROC_SUFFIX(F, S) interface->f ## F = \ | 22 #define WGL_SET_PROC_SUFFIX(F, S) interface->fFunctions.f ## F = (GrGL ## F ## P
roc) wglGetProcAddress("gl" #F #S); |
| 23 (GrGL ## F ## Proc) wglGetProcAddress("gl" #F
#S); | |
| 24 | 23 |
| 25 class AutoLibraryUnload { | 24 class AutoLibraryUnload { |
| 26 public: | 25 public: |
| 27 AutoLibraryUnload(const char* moduleName) { | 26 AutoLibraryUnload(const char* moduleName) { |
| 28 fModule = LoadLibrary(moduleName); | 27 fModule = LoadLibrary(moduleName); |
| 29 } | 28 } |
| 30 ~AutoLibraryUnload() { | 29 ~AutoLibraryUnload() { |
| 31 if (NULL != fModule) { | 30 if (NULL != fModule) { |
| 32 FreeLibrary(fModule); | 31 FreeLibrary(fModule); |
| 33 } | 32 } |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 } | 305 } |
| 307 | 306 |
| 308 interface->fStandard = kGL_GrGLStandard; | 307 interface->fStandard = kGL_GrGLStandard; |
| 309 interface->fExtensions.swap(&extensions); | 308 interface->fExtensions.swap(&extensions); |
| 310 | 309 |
| 311 return interface; | 310 return interface; |
| 312 } else { | 311 } else { |
| 313 return NULL; | 312 return NULL; |
| 314 } | 313 } |
| 315 } | 314 } |
| OLD | NEW |