summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2005-02-22 23:18:49 +0000
committerKenneth Russel <[email protected]>2005-02-22 23:18:49 +0000
commit3c4de5b235dff7a2bb98ccd1e7e35f82e8e8cd55 (patch)
tree2ce1b8297389e8f54db3a895a72ba77151ac45e4
parent31f983a480c2ef2f6879023130c3373b1a5dcb8f (diff)
Fixed bug in gluScaleImage pointed out by user benjunmun on javagaming
forums. No test case yet, but fix seems correct. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@232 232f8b59-042b-4e1e-8c03-345bb8c30851
-rw-r--r--make/glu-impl-common-CustomJavaCode.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/make/glu-impl-common-CustomJavaCode.java b/make/glu-impl-common-CustomJavaCode.java
index e9cadfc0d..0706aa390 100644
--- a/make/glu-impl-common-CustomJavaCode.java
+++ b/make/glu-impl-common-CustomJavaCode.java
@@ -424,12 +424,16 @@ public int gluScaleImageJava( int format, int widthin, int heightin,
in = (ByteBuffer)datain;
} else if( datain instanceof byte[] ) {
in = ByteBuffer.allocateDirect( ((byte[])datain).length ).order( ByteOrder.nativeOrder() );
+ in.put((byte[]) datain).rewind();
} else if( datain instanceof short[] ) {
in = ByteBuffer.allocateDirect( ((byte[])datain).length * 2 ).order( ByteOrder.nativeOrder() );
+ in.asShortBuffer().put((short[]) datain).rewind();
} else if( datain instanceof int[] ) {
in = ByteBuffer.allocateDirect( ((byte[])datain).length * 4 ).order( ByteOrder.nativeOrder() );
+ in.asIntBuffer().put((int[]) datain).rewind();
} else if( datain instanceof float[] ) {
in = ByteBuffer.allocateDirect( ((byte[])datain).length * 4 ).order( ByteOrder.nativeOrder() );
+ in.asFloatBuffer().put((float[]) datain).rewind();
} else {
throw new IllegalArgumentException( "Input data must be a primitive array or a ByteBuffer" );
}