diff options
Diffstat (limited to 'CNativeCode/OpenGLU_JauJNI12nf_funcs.c')
-rwxr-xr-x | CNativeCode/OpenGLU_JauJNI12nf_funcs.c | 78 |
1 files changed, 42 insertions, 36 deletions
diff --git a/CNativeCode/OpenGLU_JauJNI12nf_funcs.c b/CNativeCode/OpenGLU_JauJNI12nf_funcs.c index d97b173..219d58c 100755 --- a/CNativeCode/OpenGLU_JauJNI12nf_funcs.c +++ b/CNativeCode/OpenGLU_JauJNI12nf_funcs.c @@ -4,35 +4,35 @@ */ -/* - * Leo Chan -- 1995 - * - * This C file takes care of all the native implementation for the - * OpenGL utility commands - * --------------- - * - * Sven Goethel - * - * September 1997 - */ - - -/*-------------------------------------------------------------------------- - * here on in is just regular apple pie C - */ - -#include "OpenGL_misc.h" - -#include "gl4java_GLUFuncJauJNInf.h" - -#include "GLCallbackHelperJNI.h" -#include "GLUCallbackJNI.h" -#include "jnitools.h" - -/** - * herein lies the native JAVA methods for the OpenGL functions. - */ - +/*
+ * Leo Chan -- 1995
+ *
+ * This C file takes care of all the native implementation for the
+ * OpenGL utility commands
+ * ---------------
+ *
+ * Sven Goethel
+ *
+ * September 1997
+ */
+
+
+/*--------------------------------------------------------------------------
+ * here on in is just regular apple pie C
+ */
+
+#include "OpenGL_misc.h"
+
+#include "gl4java_GLUFuncJauJNInf.h"
+
+#include "GLCallbackHelperJNI.h"
+#include "GLUCallbackJNI.h"
+#include "jnitools.h"
+
+/**
+ * herein lies the native JAVA methods for the OpenGL functions.
+ */
+
static const char _glu_n_a_string[] = "GLU-String not avaiable !"; JNIEXPORT jstring JNICALL @@ -628,7 +628,7 @@ Java_gl4java_GLUFuncJauJNInf_gluNewTess( JNIEnv *env, jobject obj) /** * Original Function-Prototype : * <pre> - extern GLint gluScaleImage ( GLenum format , GLsizei widthin , GLsizei heightin , GLenum typein , const char * datain , GLsizei widthout , GLsizei heightout , GLenum typeout , char * dataout ) ; + extern GLint gluScaleImage ( GLenum format , GLsizei widthin , GLsizei heightin , GLenum typein , const GLbyte * datain , GLsizei widthout , GLsizei heightout , GLenum typeout , GLbyte * dataout ) ; * </pre> */ JNIEXPORT jint JNICALL @@ -638,7 +638,7 @@ Java_gl4java_GLUFuncJauJNInf_gluNewTess( JNIEnv *env, jobject obj) jint widthin, jint heightin, jint typein, - jstring datain, + jbyteArray datain, jint widthout, jint heightout, jint typeout, @@ -646,13 +646,16 @@ Java_gl4java_GLUFuncJauJNInf_gluNewTess( JNIEnv *env, jobject obj) { jint ret; - char *ptr4 = NULL; + jbyte *ptr4 = NULL; jboolean isCopiedArray8 = JNI_FALSE; jbyte *ptr8 = NULL; if ( disp__gluScaleImage == NULL ) return 0; - ptr4 = jnitoolsGetJavaString(env, datain); + if(datain!=NULL) + { + ptr4 = (jbyte *) (*env)->GetPrimitiveArrayCritical(env, datain, 0); + } if(dataout!=NULL) { ptr8 = (jbyte *) (*env)->GetPrimitiveArrayCritical(env, dataout, &isCopiedArray8); @@ -662,14 +665,17 @@ Java_gl4java_GLUFuncJauJNInf_gluNewTess( JNIEnv *env, jobject obj) (GLsizei) widthin, (GLsizei) heightin, (GLenum) typein, - (const char *) ptr4, + (const GLbyte *) ptr4, (GLsizei) widthout, (GLsizei) heightout, (GLenum) typeout, - (char *) ptr8 + (GLbyte *) ptr8 ); - free(ptr4); + if(datain!=NULL) + { + (*env)->ReleasePrimitiveArrayCritical(env, datain, ptr4, JNI_ABORT); + } if(dataout!=NULL) { (*env)->ReleasePrimitiveArrayCritical(env, dataout, ptr8, (isCopiedArray8 == JNI_TRUE)?0:JNI_ABORT); |