This patch (committed) fixes a couple of minor failures in Mauve and adds some
API docs:
2006-07-17 David Gilbert <[EMAIL PROTECTED]>
* java/awt/image/SinglePixelPackedSampleModel.java
(getSampleSize): Return copy of array,
(getOffset): Added API docs,
(getScanlineStride): Likewise,
(hashCode): Implemented.
Regards,
Dave
Index: java/awt/image/SinglePixelPackedSampleModel.java
===================================================================
RCS file:
/sources/classpath/classpath/java/awt/image/SinglePixelPackedSampleModel.java,v
retrieving revision 1.12
diff -u -r1.12 SinglePixelPackedSampleModel.java
--- java/awt/image/SinglePixelPackedSampleModel.java 13 Jul 2006 15:45:30
-0000 1.12
+++ java/awt/image/SinglePixelPackedSampleModel.java 17 Jul 2006 15:02:52
-0000
@@ -171,7 +171,7 @@
*/
public int[] getSampleSize()
{
- return sampleSize;
+ return (int[]) sampleSize.clone();
}
/**
@@ -187,6 +187,14 @@
return sampleSize[band];
}
+ /**
+ * Returns the index in the data buffer that stores the pixel at (x, y).
+ *
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return The index in the data buffer that stores the pixel at (x, y).
+ */
public int getOffset(int x, int y)
{
return scanlineStride*y + x;
@@ -202,6 +210,12 @@
return bitMasks;
}
+ /**
+ * Returns the number of data elements from a pixel in one row to the
+ * corresponding pixel in the next row.
+ *
+ * @return The scanline stride.
+ */
public int getScanlineStride()
{
return scanlineStride;
@@ -619,6 +633,27 @@
}
/**
+ * Returns a hash code for this <code>SinglePixelPackedSampleModel</code>.
+ *
+ * @return A hash code.
+ */
+ public int hashCode()
+ {
+ // this hash code won't match Sun's, but that shouldn't matter...
+ int result = 193;
+ result = 37 * result + dataType;
+ result = 37 * result + width;
+ result = 37 * result + height;
+ result = 37 * result + numBands;
+ result = 37 * result + scanlineStride;
+ for (int i = 0; i < bitMasks.length; i++)
+ result = 37 * result + bitMasks[i];
+ for (int i = 0; i < bitOffsets.length; i++)
+ result = 37 * result + bitOffsets[i];
+ return result;
+ }
+
+ /**
* Creates a String with some information about this SampleModel.
* @return A String describing this SampleModel.
* @see java.lang.Object#toString()