]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Bug 25758 (patch by Finn Bock) -- Fix of content-height/content-width
authorGlen Mazza <gmazza@apache.org>
Sat, 27 Dec 2003 20:40:04 +0000 (20:40 +0000)
committerGlen Mazza <gmazza@apache.org>
Sat, 27 Dec 2003 20:40:04 +0000 (20:40 +0000)
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

index 2b3430fbf64efc9c9753ee92e6431ff40d195936..dc063251617101ec6dfb4cae9be55058e22e2866 100644 (file)
@@ -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);