From 7ee398fe4ea0db13802143e24baa67160d3d3326 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Mon, 23 Apr 2007 16:47:25 +0000 Subject: [PATCH] Added support for non-direct buffers to Cursor --- src/java/org/lwjgl/input/Cursor.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/java/org/lwjgl/input/Cursor.java b/src/java/org/lwjgl/input/Cursor.java index 0e14b490..2e22b66c 100644 --- a/src/java/org/lwjgl/input/Cursor.java +++ b/src/java/org/lwjgl/input/Cursor.java @@ -35,6 +35,7 @@ import java.nio.IntBuffer; import org.lwjgl.BufferChecks; import org.lwjgl.BufferUtils; +import org.lwjgl.NondirectBufferWrapper; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; import org.lwjgl.Sys; @@ -86,13 +87,13 @@ public class Cursor { synchronized (OpenGLPackageAccess.global_lock) { if ((getCapabilities() & CURSOR_ONE_BIT_TRANSPARENCY) == 0) throw new LWJGLException("Native cursors not supported"); - BufferChecks.checkBuffer(images, width*height*numImages); + images = NondirectBufferWrapper.wrapBuffer(images, width*height*numImages); + if (delays != null) + delays = NondirectBufferWrapper.wrapBuffer(delays, numImages); if (!Mouse.isCreated()) throw new IllegalStateException("Mouse must be created before creating cursor objects"); if (width*height*numImages > images.remaining()) throw new IllegalArgumentException("width*height*numImages > images.remaining()"); - if (delays != null && numImages > delays.remaining()) - BufferChecks.checkBuffer(delays, numImages); if (xHotspot >= width || xHotspot < 0) throw new IllegalArgumentException("xHotspot > width || xHotspot < 0"); if (yHotspot >= height || yHotspot < 0)