| 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/GrGLAssembleInterface.h" |  10 #include "gl/GrGLAssembleInterface.h" | 
 |  11 #include "gl/GrGLUtil.h" | 
|  11 #define WIN32_LEAN_AND_MEAN |  12 #define WIN32_LEAN_AND_MEAN | 
|  12 #include <windows.h> |  13 #include <windows.h> | 
|  13  |  14  | 
 |  15 #include <GL/gl.h> | 
 |  16  | 
 |  17 #define GET_PROC(F) functions->f ## F = (GrGL ## F ## Proc) get(ctx, "gl" #F) | 
 |  18 #define GET_PROC_SUFFIX(F, S) functions->f ## F = (GrGL ## F ## Proc) get(ctx, "
    gl" #F #S) | 
 |  19 #define GET_PROC_LOCAL(F) GrGL ## F ## Proc F = (GrGL ## F ## Proc) get(ctx, "gl
    " #F) | 
 |  20  | 
 |  21 #define GET_LINKED GET_PROC | 
 |  22 #define GET_LINKED_SUFFIX GET_PROC_SUFFIX | 
 |  23  | 
 |  24 #include "gl/GrGLAssembleGLESInterface.h" | 
 |  25  | 
|  14 class AutoLibraryUnload { |  26 class AutoLibraryUnload { | 
|  15 public: |  27 public: | 
|  16     AutoLibraryUnload(const char* moduleName) { |  28     AutoLibraryUnload(const char* moduleName) { | 
|  17         fModule = LoadLibrary(moduleName); |  29         fModule = LoadLibrary(moduleName); | 
|  18     } |  30     } | 
|  19     ~AutoLibraryUnload() { |  31     ~AutoLibraryUnload() { | 
|  20         if (NULL != fModule) { |  32         if (NULL != fModule) { | 
|  21             FreeLibrary(fModule); |  33             FreeLibrary(fModule); | 
|  22         } |  34         } | 
|  23     } |  35     } | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  63 const GrGLInterface* GrGLCreateNativeInterface() { |  75 const GrGLInterface* GrGLCreateNativeInterface() { | 
|  64     if (NULL == wglGetCurrentContext()) { |  76     if (NULL == wglGetCurrentContext()) { | 
|  65         return NULL; |  77         return NULL; | 
|  66     } |  78     } | 
|  67  |  79  | 
|  68     GLProcGetter getter; |  80     GLProcGetter getter; | 
|  69     if (!getter.isInitialized()) { |  81     if (!getter.isInitialized()) { | 
|  70         return NULL; |  82         return NULL; | 
|  71     } |  83     } | 
|  72  |  84  | 
|  73     return GrGLAssembleGLInterface(&getter, win_get_gl_proc); |  85     const char* verStr = reinterpret_cast<const char*>(glGetString(GR_GL_VERSION
    )); | 
 |  86     GrGLStandard standard = GrGLGetStandardInUseFromString(verStr); | 
 |  87  | 
 |  88     if (kGLES_GrGLStandard == standard) { | 
 |  89         return GrGLAssembleGLESInterface(&getter, win_get_gl_proc); | 
 |  90     } else if (kGL_GrGLStandard == standard) { | 
 |  91         return GrGLAssembleGLInterface(&getter, win_get_gl_proc); | 
 |  92     } | 
 |  93     return NULL; | 
|  74 } |  94 } | 
| OLD | NEW |