Author: acumiskey
Date: Wed Oct 22 04:28:48 2008
New Revision: 707036

URL: http://svn.apache.org/viewvc?rev=707036&view=rev
Log:
Ensures > 0 coordinate values.

Modified:
    
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java

Modified: 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java?rev=707036&r1=707035&r2=707036&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java
 Wed Oct 22 04:28:48 2008
@@ -357,6 +357,13 @@
         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 @@
         }
 
         // 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);



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to