[PATCH] Fix getPixel returning double and float in libjava

Chris Meyer cmeyer@ultratask.com
Thu Aug 9 14:36:00 GMT 2001


[Sorry - submitted this to gcc-patches before I saw a mailing list 
for java-patches...]

Poring over the source code last night I noticed these problems with 
the GetPixel function returning double and float arrays for the 
SampleModel in libjava. These changes are untested, uncompiled, and 
not associated with any known bug report... But I thought I'd submit 
them anyway since they seem rather obvious.

Index: SampleModel.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/image/SampleModel.java,v
retrieving revision 1.2
diff -c -3 -p -r1.2 SampleModel.java
*** SampleModel.java    2000/08/29 03:23:57     1.2
--- SampleModel.java    2001/08/09 21:23:30
*************** public abstract class SampleModel
*** 179,185 ****

       for (int b=0; b<numBands; b++)
         {
!         fArray[0] = getSampleFloat(x, y, b, data);
         }
       return fArray;
     }
--- 179,185 ----

       for (int b=0; b<numBands; b++)
         {
!         fArray[b] = getSampleFloat(x, y, b, data);
         }
       return fArray;
     }
*************** public abstract class SampleModel
*** 188,194 ****
       if (dArray == null) dArray = new double[numBands];
       for (int b=0; b<numBands; b++)
         {
!       dArray[0] = getSampleDouble(x, y, b, data);
         }
       return dArray;
     }
--- 188,194 ----
       if (dArray == null) dArray = new double[numBands];
       for (int b=0; b<numBands; b++)
         {
!       dArray[b] = getSampleDouble(x, y, b, data);
         }
       return dArray;
     }



More information about the Java-patches mailing list