aboutsummaryrefslogtreecommitdiffstats
path: root/src/org
diff options
context:
space:
mode:
authoreschaeffer <eschaeffer@unknown>2000-05-31 15:23:03 +0000
committereschaeffer <eschaeffer@unknown>2000-05-31 15:23:03 +0000
commitc3630921dedb480bbf82f50047afd90fe32a936a (patch)
tree587e2a04552b12026d68d13bded2bb41d89fc9a9 /src/org
parentcb102dcd7b5ceceec280881838948438d980062a (diff)
downloadxmlgraphics-fop-c3630921dedb480bbf82f50047afd90fe32a936a.tar.gz
xmlgraphics-fop-c3630921dedb480bbf82f50047afd90fe32a936a.zip
check if there's enougth space left on the page to draw the image
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193394 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org')
-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,