From b4991d6ed202963ea66456b0abbcb1698f2712da Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 23 Jan 2015 22:08:41 +0100 Subject: Bug 1096 - Add missing EGLContext.c native code As required for commit d0676451343e826e49d9c5732320f080d4c11c8d --- src/jogl/native/EGLContext.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/jogl/native/EGLContext.c (limited to 'src/jogl') diff --git a/src/jogl/native/EGLContext.c b/src/jogl/native/EGLContext.c new file mode 100644 index 000000000..7bf60b850 --- /dev/null +++ b/src/jogl/native/EGLContext.c @@ -0,0 +1,39 @@ +#include +#include +#include + +#include + +#include /* android */ +#include +#include +#include + +/* Java->C glue code: + * Java package: jogamp.opengl.egl.EGLContext + * Java method: long dispatch_eglGetProcAddress(java.lang.String procname) + * C function: __EGLFuncPtr eglGetProcAddress(const char * procname) + */ +JNIEXPORT jlong JNICALL +Java_jogamp_opengl_egl_EGLContext_dispatch_1eglGetProcAddress0__Ljava_lang_String_2J(JNIEnv *env, jclass _unused, jstring procname, jlong procAddress) { + typedef __EGLFuncPtr (EGLAPIENTRY*_local_PFNEGLGETPROCADDRESSPROC)(const char * procname); + _local_PFNEGLGETPROCADDRESSPROC ptr_eglGetProcAddress; + const char* _strchars_procname = NULL; + __EGLFuncPtr _res; + if ( NULL != procname ) { + _strchars_procname = (*env)->GetStringUTFChars(env, procname, (jboolean*)NULL); + if ( NULL == _strchars_procname ) { + (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/OutOfMemoryError"), + "Failed to get UTF-8 chars for argument \"procname\" in native dispatcher for \"dispatch_eglGetProcAddress\""); + return 0; + } + } + ptr_eglGetProcAddress = (_local_PFNEGLGETPROCADDRESSPROC) (intptr_t) procAddress; + assert(ptr_eglGetProcAddress != NULL); + _res = (* ptr_eglGetProcAddress) ((const char *) _strchars_procname); + if ( NULL != procname ) { + (*env)->ReleaseStringUTFChars(env, procname, _strchars_procname); + } + return (jlong) (intptr_t) _res; +} + -- cgit v1.2.3