From 97ab9cd1ef50c9e723454c57a1d8e0b24be253e6 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Thu, 27 Apr 2006 21:19:28 +0000 Subject: Fixed problem in Java gluScaleImage implementation raised by user invictus on javagaming.org forums when destination buffer was a ByteBuffer git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@742 232f8b59-042b-4e1e-8c03-345bb8c30851 --- make/glu-CustomJavaCode.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'make/glu-CustomJavaCode.java') diff --git a/make/glu-CustomJavaCode.java b/make/glu-CustomJavaCode.java index 1ea4f20b9..17e1169c1 100644 --- a/make/glu-CustomJavaCode.java +++ b/make/glu-CustomJavaCode.java @@ -1292,14 +1292,16 @@ private int gluScaleImageJava( int format, int widthin, int heightin, widthout, heightout, typeout, out ); if( errno == 0 ) { out.rewind(); - if( dataout instanceof ShortBuffer ) { - ((ShortBuffer) dataout).put(out.asShortBuffer()); - } else if( dataout instanceof IntBuffer ) { - ((IntBuffer) dataout).put(out.asIntBuffer()); - } else if( dataout instanceof FloatBuffer ) { - ((FloatBuffer) dataout).put(out.asFloatBuffer()); - } else { - throw new RuntimeException("Should not reach here"); + if (out != dataout) { + if( dataout instanceof ShortBuffer ) { + ((ShortBuffer) dataout).put(out.asShortBuffer()); + } else if( dataout instanceof IntBuffer ) { + ((IntBuffer) dataout).put(out.asIntBuffer()); + } else if( dataout instanceof FloatBuffer ) { + ((FloatBuffer) dataout).put(out.asFloatBuffer()); + } else { + throw new RuntimeException("Should not reach here"); + } } } return( errno ); -- cgit v1.2.3