[multiple changes]

2003-09-26  Sascha Brawer  <brawer@dandelis.ch>

	* java/awt/image/SinglePixelPackedSampleModel.java (createDataBuffer):
	Save space for some pixels at the buffer end.  Added Javadoc.

2003-09-26  Tom Tromey  <tromey@redhat.com>

	* java/io/ObjectOutputStream.java (writeFields): Fixed
	indentation.
	(putFields): Likewise.

From-SVN: r71829
This commit is contained in:
Michael Koch 2003-09-26 19:59:56 +00:00
parent 8aa43dd09b
commit fc56f7acc1
3 changed files with 151 additions and 130 deletions

View File

@ -1,3 +1,14 @@
2003-09-26 Sascha Brawer <brawer@dandelis.ch>
* java/awt/image/SinglePixelPackedSampleModel.java (createDataBuffer):
Save space for some pixels at the buffer end. Added Javadoc.
2003-09-26 Tom Tromey <tromey@redhat.com>
* java/io/ObjectOutputStream.java (writeFields): Fixed
indentation.
(putFields): Likewise.
2003-09-26 Michael Koch <konqueror@gmx.de>
* java/nio/ByteBufferHelper.java:

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000, 2002 Free Software Foundation
/* Copyright (C) 2000, 2002, 2003 Free Software Foundation
This file is part of GNU Classpath.
@ -88,13 +88,25 @@ public class SinglePixelPackedSampleModel extends SampleModel
return new SinglePixelPackedSampleModel(dataType, w, h, bitMasks);
}
/**
* 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.
*/
public DataBuffer createDataBuffer()
{
// Important: use scanlineStride here, not width!
int size = scanlineStride*height;
int size;
// 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 - 1) + width;
return Buffers.createBuffer(getDataType(), size);
}
public int[] getSampleSize()
{
return sampleSize;

View File

@ -870,10 +870,10 @@ public class ObjectOutputStream extends OutputStream
{
currentPutField = new PutField ()
{
private byte[] prim_field_data
= new byte[currentObjectStreamClass.primFieldSize];
private Object[] objs
= new Object[currentObjectStreamClass.objectFieldCount];
private byte[] prim_field_data =
new byte[currentObjectStreamClass.primFieldSize];
private Object[] objs =
new Object[currentObjectStreamClass.objectFieldCount];
public void put (String name, boolean value)
{
@ -996,12 +996,11 @@ public class ObjectOutputStream extends OutputStream
private void checkType (ObjectStreamField field, char type)
throws IllegalArgumentException
{
if (TypeSignature.getEncodingOfClass (field.getType ()).charAt (0)
if (TypeSignature.getEncodingOfClass(field.getType ()).charAt(0)
!= type)
throw new IllegalArgumentException ();
}
};
// end PutFieldImpl
}
return currentPutField;
@ -1013,8 +1012,7 @@ public class ObjectOutputStream extends OutputStream
if (currentPutField == null)
throw new NotActiveException ("writeFields can only be called after putFields has been called");
// moved here from putFields since putFields
// may be called more than once, but not writeFields
// putFields may be called more than once, but not writeFields.
markFieldsWritten();
currentPutField.write (this);