Hello, Recent changes to com.sun.imageio.plugins.png.PNGImagereader have caused some performance issues when loading PNG images in FOP. I reported some recently (which had already been reported here before) and I found another change now. This new performance slowdown happens in the jdk code (not FOP or xmlgraphics). For the image and I have been using for testing (a PNG generated from a TIFF) the impact is around 20%.
The code change happens in the decodePass() method of the above class. Around line 1050, the code changed from boolean useSetRect = srcXStep == 1 && updateXStep == 1 && !adjustBitDepths; to boolean useSetRect = srcXStep == 1 && updateXStep == 1 && !adjustBitDepths && (imRas instanceof ByteInterleavedRaster); For the image I have been using the useSetRect boolean becomes false while before was true. The slowdown happens a bit down in the code, around line 1130. if (useSetRect) { imRas.setRect(updateMinX, dstY, passRow); } else { int newSrcX = srcX; for (int dstX = updateMinX; dstX < updateMinX + updateWidth; dstX += updateXStep) { passRow.getPixel(newSrcX, 0, ps); if (adjustBitDepths) { for (int b = 0; b < numBands; b++) { ps[b] = scale[b][ps[b]]; } } imRas.setPixel(dstX, dstY, ps); newSrcX += srcXStep; } } While before the code was taking the first path now takes the second, which is slower... Since the slowdown happens in the jdk it seems to me the only way to recover the previous performance is to process the image beforehand so that the WritableRaster above (imRas) becomes an instance of ByteInterleaveRaster, instead of the BytePackedRaster it is now. Any suggestions or comments? Thanks, Luis