]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Fixed regression introduced by rev 1137971:
authorJeremias Maerki <jeremias@apache.org>
Tue, 21 Jun 2011 15:07:50 +0000 (15:07 +0000)
committerJeremias Maerki <jeremias@apache.org>
Tue, 21 Jun 2011 15:07:50 +0000 (15:07 +0000)
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

src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java

index 61ac06382d2cd9e1f50cad23b09cfbc87beffe2d..c516da7024e9f1d05f48cf94ef784c0a592e0d30 100644 (file)
@@ -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);