From d0cb3249faf74ff6aafb9005a447760c02c902c5 Mon Sep 17 00:00:00 2001 From: Glen Mazza Date: Sat, 27 Dec 2003 20:40:04 +0000 Subject: [PATCH] Bug 25758 (patch by Finn Bock) -- Fix of content-height/content-width for images, to satisfy NIST test adp-height1.fo git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197057 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/fo/flow/ExternalGraphic.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java index 2b3430fbf..dc0632516 100644 --- a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java +++ b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java @@ -167,13 +167,14 @@ public class ExternalGraphic extends FObj { url = null; return; } - if (cwidth == -1) { + if (cwidth == -1 && cheight == -1) { cwidth = (int)(fopimage.getWidth() * 1000); - } - if (cheight == -1) { cheight = (int)(fopimage.getHeight() * 1000); - } - if (scaling == Scaling.UNIFORM) { + } else if (cwidth == -1) { + cwidth = (int)(fopimage.getWidth() * cheight) / fopimage.getHeight(); + } else if (cheight == -1) { + cheight = (int)(fopimage.getHeight() * cwidth) / fopimage.getWidth(); + } else { // adjust the larger double rat1 = cwidth / (fopimage.getWidth() * 1000f); double rat2 = cheight / (fopimage.getHeight() * 1000f); -- 2.39.5