From: Jeremias Maerki Date: Tue, 21 Jun 2011 15:07:50 +0000 (+0000) Subject: Fixed regression introduced by rev 1137971: X-Git-Tag: fop-1_1rc1old~204 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=634a8abadc68ea5727410dc08b8aab2aa7a6c3a6;p=xmlgraphics-fop.git Fixed regression introduced by rev 1137971: Bi-level images that are generated as page segments and don't need to be resampled produced garbled output because the size of the image data got set to wrong values. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1138036 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java b/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java index 61ac06382..c516da702 100644 --- a/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java +++ b/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java @@ -151,6 +151,7 @@ public class AFPImageHandlerRenderedImage extends AFPImageHandler implements Ima private boolean useFS10; private int maxPixelSize; private boolean usePageSegments; + private boolean resample; private Dimension resampledDim; private ImageSize intrinsicSize; private ImageSize effIntrinsicSize; @@ -187,8 +188,14 @@ public class AFPImageHandlerRenderedImage extends AFPImageHandler implements Ima (int)Math.ceil(UnitConv.mpt2px(targetSize.getWidth(), resolution)), (int)Math.ceil(UnitConv.mpt2px(targetSize.getHeight(), resolution))); resourceInfo.setImageDimension(resampledDim); - effIntrinsicSize = new ImageSize( - resampledDim.width, resampledDim.height, resolution); + //Only resample/downsample if image is smaller than its intrinsic size + //to make print file smaller + this.resample = resampledDim.width < renderedImage.getWidth() + && resampledDim.height < renderedImage.getHeight(); + if (resample) { + effIntrinsicSize = new ImageSize( + resampledDim.width, resampledDim.height, resolution); + } } //Update image object info @@ -221,11 +228,7 @@ public class AFPImageHandlerRenderedImage extends AFPImageHandler implements Ima imageObjectInfo.setCreatePageSegment(true); float ditheringQuality = paintingState.getDitheringQuality(); - //Only resample/downsample if image is smaller than its intrinsic size - //to make print file smaller - boolean resample = resampledDim.width < renderedImage.getWidth() - && resampledDim.height < renderedImage.getHeight(); - if (resample) { + if (this.resample) { if (log.isDebugEnabled()) { log.debug("Resample from " + intrinsicSize.getDimensionPx() + " to " + resampledDim);