| OLD | NEW |
| 1 | |
| 2 /* | 1 /* |
| 3 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 4 * | 3 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 7 */ | 6 */ |
| 8 | 7 |
| 9 #include "gl/GrGLInterface.h" | 8 #include "gl/GrGLInterface.h" |
| 10 #include "gl/GrGLAssembleInterface.h" | 9 #include "gl/GrGLAssembleInterface.h" |
| 11 #include <dlfcn.h> | 10 #include <dlfcn.h> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 32 void* fLibrary; | 31 void* fLibrary; |
| 33 }; | 32 }; |
| 34 | 33 |
| 35 class GLProcGetter { | 34 class GLProcGetter { |
| 36 public: | 35 public: |
| 37 GLProcGetter() {} | 36 GLProcGetter() {} |
| 38 | 37 |
| 39 GrGLFuncPtr getProc(const char name[]) const { | 38 GrGLFuncPtr getProc(const char name[]) const { |
| 40 return (GrGLFuncPtr) dlsym(fLoader.handle(), name); | 39 return (GrGLFuncPtr) dlsym(fLoader.handle(), name); |
| 41 } | 40 } |
| 42 | 41 |
| 43 private: | 42 private: |
| 44 GLLoader fLoader; | 43 GLLoader fLoader; |
| 45 }; | 44 }; |
| 46 | 45 |
| 47 static GrGLFuncPtr ios_get_gl_proc(void* ctx, const char name[]) { | 46 static GrGLFuncPtr ios_get_gl_proc(void* ctx, const char name[]) { |
| 48 SkASSERT(ctx); | 47 SkASSERT(ctx); |
| 49 const GLProcGetter* getter = (const GLProcGetter*) ctx; | 48 const GLProcGetter* getter = (const GLProcGetter*) ctx; |
| 50 return getter->getProc(name); | 49 return getter->getProc(name); |
| 51 } | 50 } |
| 52 | 51 |
| 53 const GrGLInterface* GrGLCreateNativeInterface() { | 52 const GrGLInterface* GrGLCreateNativeInterface() { |
| 54 GLProcGetter getter; | 53 GLProcGetter getter; |
| 55 return GrGLAssembleGLESInterface(&getter, ios_get_gl_proc); | 54 return GrGLAssembleGLESInterface(&getter, ios_get_gl_proc); |
| 56 } | 55 } |
| OLD | NEW |