From d04c4920b8e1be230b7ef0ce22c480ef6a38772e Mon Sep 17 00:00:00 2001 From: Brian Matzon Date: Sun, 21 Nov 2004 10:10:05 +0000 Subject: [PATCH] use safeGetBufferAddress when loading data use correct size of image, instead of size of pointer (!) --- src/native/common/devil/org_lwjgl_devil_IL.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/native/common/devil/org_lwjgl_devil_IL.c b/src/native/common/devil/org_lwjgl_devil_IL.c index de49c031..9e812589 100644 --- a/src/native/common/devil/org_lwjgl_devil_IL.c +++ b/src/native/common/devil/org_lwjgl_devil_IL.c @@ -270,7 +270,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilGetBoolean(JNIEnv *env, jcl JNIEXPORT jobject JNICALL Java_org_lwjgl_devil_IL_ilGetData(JNIEnv * env, jclass clazz) { ILubyte *data = ilGetData(); - int size = sizeof(data); + int size = ilGetInteger(IL_IMAGE_WIDTH) * ilGetInteger(IL_IMAGE_HEIGHT) * ilGetInteger(IL_IMAGE_BYTES_PER_PIXEL); jobject result = safeNewBuffer(env, data, size); return result; @@ -438,9 +438,9 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_ilLoadImage(JNIEnv *env, jcla * Signature: (ILjava/nio/ByteBuffer;II)Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_devil_IL_nilLoadL(JNIEnv *env, jclass clazz, jint type, jobject lump_buffer, jint lump_offset, jint size) { - ILbyte *lump = (ILbyte *)(*env)->GetDirectBufferAddress(env, lump_buffer); + ILbyte *lump = (ILbyte *)safeGetBufferAddress(env, lump_buffer, lump_offset); - return ilLoadL((ILenum)type, (ILvoid *)(lump + lump_offset), (ILuint)size); + return ilLoadL((ILenum)type, (ILvoid *)(lump), (ILuint)size); } /*