OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 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 #include "gl/GrGLInterface.h" | 8 #include "gl/GrGLInterface.h" |
9 #include "gl/GrGLAssembleInterface.h" | 9 #include "gl/GrGLAssembleInterface.h" |
10 #include "gl/GrGLUtil.h" | 10 #include "gl/GrGLUtil.h" |
11 | 11 |
12 #include <EGL/egl.h> | 12 #include <EGL/egl.h> |
13 #include <GLES2/gl2.h> | 13 #include <GLES2/gl2.h> |
14 | 14 |
15 static GrGLFuncPtr egl_get_gl_proc(void* ctx, const char name[]) { | 15 static GrGLFuncPtr egl_get_gl_proc(void* ctx, const char name[]) { |
16 SkASSERT(nullptr == ctx); | 16 SkASSERT(nullptr == ctx); |
17 return eglGetProcAddress(name); | 17 GrGLFuncPtr ptr = eglGetProcAddress(name); |
| 18 if (!ptr) { |
| 19 if (0 == strcmp("eglQueryString", name)) { |
| 20 return (GrGLFuncPtr)eglQueryString; |
| 21 } else if (0 == strcmp("eglGetCurrentDisplay", name)) { |
| 22 return (GrGLFuncPtr)eglGetCurrentDisplay; |
| 23 } |
| 24 } |
| 25 return ptr; |
18 } | 26 } |
19 | 27 |
20 const GrGLInterface* GrGLCreateNativeInterface() { | 28 const GrGLInterface* GrGLCreateNativeInterface() { |
21 return GrGLAssembleInterface(nullptr, egl_get_gl_proc); | 29 return GrGLAssembleInterface(nullptr, egl_get_gl_proc); |
22 } | 30 } |
OLD | NEW |