aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/apache')
-rw-r--r--src/org/apache/fop/fo/flow/DisplayGraphic.java14
-rw-r--r--src/org/apache/fop/fo/flow/InlineGraphic.java14
2 files changed, 20 insertions, 8 deletions
diff --git a/src/org/apache/fop/fo/flow/DisplayGraphic.java b/src/org/apache/fop/fo/flow/DisplayGraphic.java
index fe6f2efbd..348833804 100644
--- a/src/org/apache/fop/fo/flow/DisplayGraphic.java
+++ b/src/org/apache/fop/fo/flow/DisplayGraphic.java
@@ -162,14 +162,20 @@ public class DisplayGraphic extends FObj {
double imgWidth = img.getWidth();
double imgHeight = img.getHeight();
if ((width == 0) && (height == 0)) {
- width = (int) (imgWidth / 2d * 1000d);
- height = (int) (imgHeight / 2d * 1000d);
+ width = (int) ((imgWidth * 1000d) / 2d);
+ height = (int) ((imgHeight * 1000d) / 2d);
} else if (height == 0) {
- height = (int) (imgHeight / imgWidth * ((double) width));
+ height = (int) ((imgHeight * ((double) width)) / imgWidth);
} else if (width == 0) {
- width = (int) (imgWidth / imgHeight * ((double) height));
+ width = (int) ((imgWidth * ((double) height)) / imgHeight);
}
+//System.err.println("DisplayGraphic: imgW=" + imgWidth + " imgH=" + imgHeight + " w=" + width + " h=" + height);
}
+
+ if (area.spaceLeft() < (height + spaceBefore)) {
+ return new Status(Status.AREA_FULL_NONE);
+ }
+
this.imageArea = new ImageArea(
fs,
img,
diff --git a/src/org/apache/fop/fo/flow/InlineGraphic.java b/src/org/apache/fop/fo/flow/InlineGraphic.java
index b6542f170..5baee4cbf 100644
--- a/src/org/apache/fop/fo/flow/InlineGraphic.java
+++ b/src/org/apache/fop/fo/flow/InlineGraphic.java
@@ -165,14 +165,20 @@ public class InlineGraphic extends FObj {
double imgWidth = img.getWidth();
double imgHeight = img.getHeight();
if ((width == 0) && (height == 0)) {
- width = (int) (imgWidth / 2d * 1000d);
- height = (int) (imgHeight / 2d * 1000d);
+ width = (int) ((imgWidth * 1000d) / 2d);
+ height = (int) ((imgHeight * 1000d) / 2d);
} else if (height == 0) {
- height = (int) (imgHeight / imgWidth * ((double) width));
+ height = (int) ((imgHeight * ((double) width)) / imgWidth);
} else if (width == 0) {
- width = (int) (imgWidth / imgHeight * ((double) height));
+ width = (int) ((imgWidth * ((double) height)) / imgHeight);
}
+//System.err.println("DisplayGraphic: imgW=" + imgWidth + " imgH=" + imgHeight + " w=" + width + " h=" + height);
}
+
+ if (area.spaceLeft() < (height + spaceBefore)) {
+ return new Status(Status.AREA_FULL_NONE);
+ }
+
this.imageArea = new ImageArea(
fs,
img,