This patch (committed) fixes a bug in the createDataBuffer() method of the
MultiPixelPackedSampleModel class. I also removed the FIXME - it doesn't apply for
this class:
2006-07-14 David Gilbert <[EMAIL PROTECTED]>
* java/awt/image/MultiPixelPackedSampleModel.java
(createDataBuffer): Include dataBitOffset in calculating the size for
the data buffer.
I have written a Mauve test for this which I'll commit soon.
Regards,
Dave
Index: java/awt/image/MultiPixelPackedSampleModel.java
===================================================================
RCS file:
/sources/classpath/classpath/java/awt/image/MultiPixelPackedSampleModel.java,v
retrieving revision 1.10
diff -u -r1.10 MultiPixelPackedSampleModel.java
--- java/awt/image/MultiPixelPackedSampleModel.java 14 Jul 2006 12:51:17
-0000 1.10
+++ java/awt/image/MultiPixelPackedSampleModel.java 14 Jul 2006 13:36:35
-0000
@@ -131,18 +131,14 @@
* Creates a DataBuffer for holding pixel data in the format and
* layout described by this SampleModel. The returned buffer will
* consist of one single bank.
+ *
+ * @return A new data buffer.
*/
public DataBuffer createDataBuffer()
{
- int size;
-
- // FIXME: The comment refers to SinglePixelPackedSampleModel. See if the
- // same can be done for MultiPixelPackedSampleModel.
- // We can save (scanlineStride - width) pixels at the very end of
- // the buffer. The Sun reference implementation (J2SE 1.3.1 and
- // 1.4.1_01) seems to do this; tested with Mauve test code.
- size = scanlineStride * height;
-
+ int size = scanlineStride * height;
+ if (dataBitOffset > 0)
+ size += (dataBitOffset - 1) / elemBits + 1;
return Buffers.createBuffer(getDataType(), size);
}