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

Side by Side Diff: src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp

Issue 133073009: Move GrGLInterface function pointers into a nested struct (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: tip of tree Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698