bckfnn 2004/10/12 23:56:49 Modified: src/java/org/apache/fop/image BatikImage.java Log: Fix a ArrayIndexOutOfBoundsException when loading indexed PNGs. PR: 31675 Submitted by: Thomas Deweese Revision Changes Path 1.2 +11 -12 xml-fop/src/java/org/apache/fop/image/BatikImage.java Index: BatikImage.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/image/BatikImage.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- BatikImage.java 11 Oct 2004 21:43:13 -0000 1.1 +++ BatikImage.java 13 Oct 2004 06:56:49 -0000 1.2 @@ -118,14 +118,15 @@ this.height = cr.getHeight(); this.width = cr.getWidth(); - - cr = new Any2sRGBRed(cr); - this.isTransparent = false; this.softMask = null; + this.bitmapsSize = this.width * this.height * 3; + this.bitmaps = new byte[this.bitmapsSize]; + this.bitsPerPixel = 8; + int transparencyType = cm.getTransparency(); - if ((transparencyType == Transparency.BITMASK) - && (cm instanceof IndexColorModel)) { + if (cm instanceof IndexColorModel) { + if (transparencyType == Transparency.BITMASK) { // Use 'transparent color'. IndexColorModel icm = (IndexColorModel)cm; int numColor = icm.getMapSize(); @@ -142,20 +143,18 @@ } } } + } else { + cr = new Any2sRGBRed(cr); + } // Get our current ColorModel cm = cr.getColorModel(); // It has an alpha channel so generate a soft mask. - if ((!this.isTransparent) && cm.hasAlpha()) { + if (!this.isTransparent && cm.hasAlpha()) this.softMask = new byte[this.width * this.height]; - } - this.bitsPerPixel = 8; - this.bitmapsSize = this.width * this.height * 3; - this.bitmaps = new byte[this.bitmapsSize]; this.colorSpace = cm.getColorSpace(); - WritableRaster wr = (WritableRaster)cr.getData(); BufferedImage bi = new BufferedImage (cm, wr.createWritableTranslatedChild(0, 0),
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]