summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--make/glu-CustomJavaCode.java18
1 files changed, 10 insertions, 8 deletions
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 );