]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Ensures > 0 coordinate values.
authorAdrian Cumiskey <acumiskey@apache.org>
Wed, 22 Oct 2008 11:28:48 +0000 (11:28 +0000)
committerAdrian Cumiskey <acumiskey@apache.org>
Wed, 22 Oct 2008 11:28:48 +0000 (11:28 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@707036 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/render/afp/modca/PresentationTextData.java

index 05ea1ebf2527bfea8d8970a74a2b420b54ac0b56..dc0512b6d29bf6ed9017860f00efc8cd4cca399d 100644 (file)
@@ -357,6 +357,13 @@ public class PresentationTextData extends AbstractAFPObject {
         baos.write(outputdata, 0, outputdata.length);
     }
 
+    private int ensurePositive(int value) {
+        if (value < 0) {
+            return 0;
+        }
+        return value;
+    }
+
     /**
      * Drawing of lines using the starting and ending coordinates, thickness and
      * colour arguments.
@@ -376,25 +383,25 @@ public class PresentationTextData extends AbstractAFPObject {
         }
 
         // Avoid unnecessary specification of the Y coordinate
-        int y1 = lineDataInfo.getY1();
+        int y1 = ensurePositive(lineDataInfo.getY1());
         if (y1 != currentY) {
             absoluteMoveBaseline(y1, afpdata);
         }
 
         // Avoid unnecessary specification of the X coordinate
-        int x1 = lineDataInfo.getX1();
+        int x1 = ensurePositive(lineDataInfo.getX1());
         if (x1 != currentX) {
             absoluteMoveInline(x1, afpdata);
         }
 
-        Color col = lineDataInfo.getColor();
-        if (!col.equals(currentColor)) {
-            setExtendedTextColor(col, afpdata);
-            currentColor = col;
+        Color color = lineDataInfo.getColor();
+        if (!color.equals(currentColor)) {
+            setExtendedTextColor(color, afpdata);
+            currentColor = color;
         }
 
-        int x2 = lineDataInfo.getX2();
-        int y2 = lineDataInfo.getY2();
+        int x2 = ensurePositive(lineDataInfo.getX2());
+        int y2 = ensurePositive(lineDataInfo.getY2());
         int thickness = lineDataInfo.getThickness();
         if (y1 == y2) {
             drawIaxisRule(x2 - x1, thickness, afpdata);