This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[gui][PATCH] More fixes to MemoryImageSource
- From: David Jee <djee at redhat dot com>
- To: java-patches at gcc dot gnu dot org
- Date: Tue, 18 May 2004 13:32:54 -0400
- Subject: [gui][PATCH] More fixes to MemoryImageSource
Hello,
I committed the following patch to the java-gui-branch. It fixes a few
bugs in MemoryImageSource.
-David Jee
2004-05-18 David Jee <djee@redhat.com>
* java/awt/image/MemoryImageSource.java
(newPixels(int,int,int,int,boolean)): Set only the specified
rectangle of pixels.
(newPixels(byte[],ColorModel,int,int)): Implement.
(newPixels(int[],ColorModel,int,int)): Implement.
Index: java/awt/image/MemoryImageSource.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/image/MemoryImageSource.java,v
retrieving revision 1.5.16.1
diff -u -r1.5.16.1 MemoryImageSource.java
--- java/awt/image/MemoryImageSource.java 17 May 2004 16:21:00 -0000 1.5.16.1
+++ java/awt/image/MemoryImageSource.java 18 May 2004 15:59:40 -0000
@@ -302,9 +302,15 @@
ic.setProperties( props );
}
if( pixeli != null ) {
- ic.setPixels( 0, 0, width, height, cm, pixeli, offset, scansize );
+ int[] pixelbuf = new int[w * h];
+ for (int row = y; row < h; row++)
+ System.arraycopy(pixeli, row * scansize + x + offset, pixelbuf, row * w, w);
+ ic.setPixels( x, y, w, h, cm, pixelbuf, 0, w );
} else {
- ic.setPixels( 0, 0, width, height, cm, pixelb, offset, scansize );
+ byte[] pixelbuf = new byte[w * h];
+ for (int row = y; row < h; row++)
+ System.arraycopy(pixelb, row * scansize + x + offset, pixelbuf, row * w, w);
+ ic.setPixels( x, y, w, h, cm, pixelbuf, 0, w );
}
if( framenotify == true )
ic.imageComplete( ImageConsumer.SINGLEFRAME );
@@ -319,9 +325,14 @@
int scansize)
{
+ pixeli = null;
+ pixelb = newpix;
+ cm = newmodel;
+ this.offset = offset;
+ this.scansize = scansize;
if( animated == true )
{
- //FIXME
+ newPixels();
}
}
@@ -331,9 +342,14 @@
int scansize)
{
+ pixelb = null;
+ pixeli = newpix;
+ cm = newmodel;
+ this.offset = offset;
+ this.scansize = scansize;
if( animated == true )
{
- //FIXME
+ newPixels();
}
}