From 040e4a7bbe9f400a28b91c2bf176d0e71f4b226c Mon Sep 17 00:00:00 2001 From: Simon Steiner Date: Mon, 28 Apr 2014 14:24:22 +0000 Subject: [PATCH] FOP-2336 OOM for tiff output git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1590653 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/render/bitmap/AbstractBitmapDocumentHandler.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/java/org/apache/fop/render/bitmap/AbstractBitmapDocumentHandler.java b/src/java/org/apache/fop/render/bitmap/AbstractBitmapDocumentHandler.java index 8d0ce14ac..38911a9e9 100644 --- a/src/java/org/apache/fop/render/bitmap/AbstractBitmapDocumentHandler.java +++ b/src/java/org/apache/fop/render/bitmap/AbstractBitmapDocumentHandler.java @@ -229,7 +229,9 @@ public abstract class AbstractBitmapDocumentHandler extends AbstractBinaryWritin } //Set up bitmap to paint on - this.currentImage = createBufferedImage(bitmapWidth, bitmapHeight); + if (currentImage == null || currentImage.getWidth() != bitmapWidth || currentImage.getHeight() != bitmapHeight) { + currentImage = createBufferedImage(bitmapWidth, bitmapHeight); + } Graphics2D graphics2D = this.currentImage.createGraphics(); // draw page background @@ -316,7 +318,6 @@ public abstract class AbstractBitmapDocumentHandler extends AbstractBinaryWritin this.multiImageWriter.writeImage(this.currentImage, getSettings().getWriterParams()); } - this.currentImage = null; } catch (IOException ioe) { throw new IFException("I/O error while encoding BufferedImage", ioe); } -- 2.39.5