Index: src/java/org/apache/fop/fo/flow/ExternalGraphic.java
===================================================================
RCS file: /home/cvspublic/xml-fop/src/java/org/apache/fop/fo/flow/ExternalGraphic.java,v
retrieving revision 1.12
diff -u -r1.12 ExternalGraphic.java
--- src/java/org/apache/fop/fo/flow/ExternalGraphic.java	20 Dec 2003 06:53:22 -0000	1.12
+++ src/java/org/apache/fop/fo/flow/ExternalGraphic.java	25 Dec 2003 16:22:05 -0000
@@ -167,13 +167,14 @@
                 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);
