Added buffer positions to Cursor

This commit is contained in:
Elias Naur 2003-08-05 20:07:32 +00:00
parent a62ebc2c3b
commit 683991fe79
5 changed files with 11 additions and 11 deletions

View File

@ -74,7 +74,7 @@ public class Cursor {
*/
public Cursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws Exception {
assert Mouse.isCreated();
nativeHandle = nCreateCursor(width, height, xHotspot, yHotspot, numImages, images, delays);
nativeHandle = nCreateCursor(width, height, xHotspot, yHotspot, numImages, images, images.position(), delays, delays != null ? delays.position() : 0);
}
/**
@ -94,7 +94,7 @@ public class Cursor {
/**
* Native method to create a native cursor
*/
private static native int nCreateCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays);
private static native int nCreateCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, int images_offset, IntBuffer delays, int delays_offset);
/**
* Native method to destroy a native cursor

View File

@ -12,10 +12,10 @@ extern "C" {
/*
* Class: org_lwjgl_input_Cursor
* Method: nCreateCursor
* Signature: (IIIIILjava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)I
* Signature: (IIIIILjava/nio/IntBuffer;ILjava/nio/IntBuffer;I)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_input_Cursor_nCreateCursor
(JNIEnv *, jclass, jint, jint, jint, jint, jint, jobject, jobject);
(JNIEnv *, jclass, jint, jint, jint, jint, jint, jobject, jint, jobject, jint);
/*
* Class: org_lwjgl_input_Cursor

View File

@ -51,8 +51,8 @@ if test "x$JAVA_HOME" = x; then
else
AC_MSG_RESULT($JAVA_HOME)
JAVA_HOME="$JAVA_HOME"
CPPFLAGS="$CPPFLAGS -D_DEBUG -fno-rtti -fno-exceptions -pthread -D_X11 -Wall -I$JAVA_HOME/include -I$JAVA_HOME/include/linux"
CFLAGS="$CFLAGS -D_DEBUG -pthread -D_X11 -Wall -I$JAVA_HOME/include -I$JAVA_HOME/include/linux"
CPPFLAGS="$CPPFLAGS -fno-rtti -fno-exceptions -pthread -D_X11 -Wall -I$JAVA_HOME/include -I$JAVA_HOME/include/linux"
CFLAGS="$CFLAGS -pthread -D_X11 -Wall -I$JAVA_HOME/include -I$JAVA_HOME/include/linux"
fi
dnl Checks for libraries.

View File

@ -8,12 +8,12 @@
* Signature: (IIIIIII)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_input_Cursor_nCreateCursor
(JNIEnv *env, jclass clazz, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jobject delay_buffer)
(JNIEnv *env, jclass clazz, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jint images_offset, jobject delay_buffer, jint delays_offset)
{
const int *delays = NULL;
if (delay_buffer != NULL)
delays = (const int *)env->GetDirectBufferAddress(delay_buffer);
XcursorPixel *pixels = (XcursorPixel *)env->GetDirectBufferAddress(image_buffer);
delays = (const int *)env->GetDirectBufferAddress(delay_buffer) + delays_offset;
XcursorPixel *pixels = (XcursorPixel *)env->GetDirectBufferAddress(image_buffer) + images_offset;
int stride = width*height;
XcursorImages *cursor_images = XcursorImagesCreate(num_images);
if (cursor_images == NULL)

View File

@ -8,9 +8,9 @@
* Signature: (IIIIIIIII)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_input_Cursor_nCreateCursor
(JNIEnv *env, jclass clazz, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jobject delay_buffer)
(JNIEnv *env, jclass clazz, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jint images_offset, jobject delay_buffer, jint delays_offset)
{
int *pixels = (int *)env->GetDirectBufferAddress(image_buffer);
int *pixels = (int *)env->GetDirectBufferAddress(image_buffer) + images_offset;
BITMAPINFO bitmapInfo;