summaryrefslogtreecommitdiffstats
path: root/src/native/jogl
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2005-11-09 00:32:37 +0000
committerKenneth Russel <[email protected]>2005-11-09 00:32:37 +0000
commitcf7b8b87f78687b8e4a867d3b18bd7f072a955ee (patch)
tree739fe8eec21acfe26cf7a684232f1219dbdd43b8 /src/native/jogl
parente42abe5e45c693abc4c06ac5c1928ee2c3fe8d27 (diff)
Refactored computations of sizes of data types and offsets of fields
in data structures in GlueGen to be performed lazily via SizeThunks. The concrete size of primitive data types is computed only by passing a MachineDescription into one of these thunks. Changed generated glue code for struct accessors to delegate their instantiation and field access to specialized 32- or 64-bit versions. This should allow one jar file to support both 32-bit and 64-bit CPUs; the native code is of course still specialized for the processor and data model. Changed default build to generate both 32-bit and 64-bit accessors for all generated data structures. Tested on Windows; more testing, including build testing, is needed on other platforms. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@426 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/native/jogl')
-rw-r--r--src/native/jogl/JAWT_DrawingSurfaceInfo.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/native/jogl/JAWT_DrawingSurfaceInfo.c b/src/native/jogl/JAWT_DrawingSurfaceInfo.c
index 2b64ec858..6eeaf053b 100644
--- a/src/native/jogl/JAWT_DrawingSurfaceInfo.c
+++ b/src/native/jogl/JAWT_DrawingSurfaceInfo.c
@@ -53,13 +53,14 @@
#endif
static jclass platformDSIClass = NULL;
-static jmethodID constructor = NULL;
+static jmethodID factoryMethod = NULL;
JNIEXPORT jobject JNICALL
Java_com_sun_opengl_impl_JAWT_1DrawingSurfaceInfo_platformInfo0(JNIEnv* env, jobject unused, jobject jthis0) {
JAWT_DrawingSurfaceInfo* dsi;
jobject dirbuf;
jclass clazz;
+ char sig[512];
dsi = (*env)->GetDirectBufferAddress(env, jthis0);
if (dsi == NULL) {
(*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/RuntimeException"),
@@ -81,14 +82,15 @@ Java_com_sun_opengl_impl_JAWT_1DrawingSurfaceInfo_platformInfo0(JNIEnv* env, job
return NULL;
}
clazz = (jclass) (*env)->NewGlobalRef(env, clazz);
- constructor = (*env)->GetMethodID(env, clazz, "<init>", "(Ljava/nio/ByteBuffer;)V");
- if (constructor == NULL) {
+ sprintf(sig, "(Ljava/nio/ByteBuffer;)L%s;", platformDSIClassName);
+ factoryMethod = (*env)->GetStaticMethodID(env, clazz, "create", sig);
+ if (factoryMethod == NULL) {
(*env)->DeleteGlobalRef(env, clazz);
return NULL;
}
platformDSIClass = clazz;
}
- return (*env)->NewObject(env, platformDSIClass, constructor, dirbuf);
+ return (*env)->CallStaticObjectMethod(env, platformDSIClass, factoryMethod, dirbuf);
}
#ifdef __sun