You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ac...@apache.org on 2008/08/20 17:13:56 UTC

svn commit: r687369 - in /xmlgraphics/fop/trunk: lib/ src/java/org/apache/fop/render/ src/java/org/apache/fop/render/pcl/ src/java/org/apache/fop/render/txt/ src/java/org/apache/fop/util/ test/java/org/apache/fop/ test/java/org/apache/fop/util/

Author: acumiskey
Date: Wed Aug 20 08:13:56 2008
New Revision: 687369

URL: http://svn.apache.org/viewvc?rev=687369&view=rev
Log:
* Updated xmlgraphics-commons-14svn.jar to reflect UnitConv additions.
* Removed UnitConv and its unit test case (now resides in commons).
* Updated all fop util package references fpr UnitConv to xmlgraphics commons util package.

Removed:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/util/UnitConv.java
    xmlgraphics/fop/trunk/test/java/org/apache/fop/util/UnitConvTestCase.java
Modified:
    xmlgraphics/fop/trunk/lib/xmlgraphics-commons-1.4svn.jar
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLGenerator.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLGraphics2D.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLGraphics2DAdapter.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLPageDefinition.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLRenderer.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/txt/TXTRenderer.java
    xmlgraphics/fop/trunk/test/java/org/apache/fop/UtilityCodeTestSuite.java

Modified: xmlgraphics/fop/trunk/lib/xmlgraphics-commons-1.4svn.jar
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/lib/xmlgraphics-commons-1.4svn.jar?rev=687369&r1=687368&r2=687369&view=diff
==============================================================================
Binary files - no diff available.

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java?rev=687369&r1=687368&r2=687369&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java Wed Aug 20 08:13:56 2008
@@ -35,7 +35,7 @@
 import java.io.IOException;
 
 import org.apache.fop.render.RendererContext.RendererContextWrapper;
-import org.apache.fop.util.UnitConv;
+import org.apache.xmlgraphics.util.UnitConv;
 
 /**
  * Abstract base class for Graphics2DAdapter implementations.

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java?rev=687369&r1=687368&r2=687369&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java Wed Aug 20 08:13:56 2008
@@ -48,7 +48,7 @@
 import org.apache.fop.fo.extensions.ExtensionElementMapping;
 import org.apache.fop.fonts.FontMetrics;
 import org.apache.fop.traits.BorderProps;
-import org.apache.fop.util.UnitConv;
+import org.apache.xmlgraphics.util.UnitConv;
 
 /**
  * Abstract base class for renderers like PDF and PostScript where many painting operations
@@ -485,8 +485,8 @@
         int borderPaddingStart = bv.getBorderAndPaddingWidthStart();
         int borderPaddingBefore = bv.getBorderAndPaddingWidthBefore();
         //This is the content-rect
-        float width = (float)bv.getIPD() / 1000f;
-        float height = (float)bv.getBPD() / 1000f;
+        float width = bv.getIPD() / 1000f;
+        float height = bv.getBPD() / 1000f;
 
         if (bv.getPositioning() == Block.ABSOLUTE
                 || bv.getPositioning() == Block.FIXED) {
@@ -581,7 +581,7 @@
             currentIPPosition = saveIP;
             currentBPPosition = saveBP;
 
-            currentBPPosition += (int)(bv.getAllocBPD());
+            currentBPPosition += (bv.getAllocBPD());
         }
     }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLGenerator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLGenerator.java?rev=687369&r1=687368&r2=687369&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLGenerator.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLGenerator.java Wed Aug 20 08:13:56 2008
@@ -45,8 +45,7 @@
 import org.apache.commons.io.output.ByteArrayOutputStream;
 
 import org.apache.xmlgraphics.image.GraphicsUtil;
-
-import org.apache.fop.util.UnitConv;
+import org.apache.xmlgraphics.util.UnitConv;
 
 /**
  * This class provides methods for generating PCL print files.
@@ -68,7 +67,7 @@
     private final DecimalFormat df2 = new DecimalFormat("0.##", symbols);
     private final DecimalFormat df4 = new DecimalFormat("0.####", symbols);
 
-    private OutputStream out;
+    private final OutputStream out;
 
     private boolean currentSourceTransparency = true;
     private boolean currentPatternTransparency = true;
@@ -79,7 +78,7 @@
      * true: Standard PCL shades are used (poor quality). false: user-defined pattern are used
      * to create custom dither patterns for better grayscale quality.
      */
-    private boolean usePCLShades = false;
+    private final boolean usePCLShades = false;
 
     /**
      * Main constructor.
@@ -400,7 +399,7 @@
     private static void setValueInMatrix(int[] dn, int half, int part, int idx, int value) {
         int xoff = (part & 1) * half;
         int yoff = (part & 2) * half * half;
-        int matrixIndex = yoff + ((int)(idx / half) * half * 2) + (idx % half) + xoff;
+        int matrixIndex = yoff + ((idx / half) * half * 2) + (idx % half) + xoff;
         dn[matrixIndex] = value;
     }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLGraphics2D.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLGraphics2D.java?rev=687369&r1=687368&r2=687369&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLGraphics2D.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLGraphics2D.java Wed Aug 20 08:13:56 2008
@@ -42,9 +42,9 @@
 import java.io.IOException;
 import java.text.AttributedCharacterIterator;
 
-import org.apache.fop.util.UnitConv;
 import org.apache.xmlgraphics.java2d.AbstractGraphics2D;
 import org.apache.xmlgraphics.java2d.GraphicContext;
+import org.apache.xmlgraphics.util.UnitConv;
 
 /**
  * Graphics2D implementation implementing PCL and HP GL/2.
@@ -55,7 +55,7 @@
     /** The PCL generator */
     protected PCLGenerator gen;
 
-    private boolean failOnUnsupportedFeature = true;
+    private final boolean failOnUnsupportedFeature = true;
     private boolean clippingDisabled = false;
 
     /**

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLGraphics2DAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLGraphics2DAdapter.java?rev=687369&r1=687368&r2=687369&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLGraphics2DAdapter.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLGraphics2DAdapter.java Wed Aug 20 08:13:56 2008
@@ -34,7 +34,7 @@
 
 import org.apache.fop.render.AbstractGraphics2DAdapter;
 import org.apache.fop.render.RendererContext;
-import org.apache.fop.util.UnitConv;
+import org.apache.xmlgraphics.util.UnitConv;
 
 /**
  * Graphics2DAdapter implementation for PCL and HP GL/2.
@@ -111,7 +111,7 @@
 
         if (!painted) {
             //Fallback solution: Paint to a BufferedImage
-            int resolution = (int)Math.round(context.getUserAgent().getTargetResolution());
+            int resolution = Math.round(context.getUserAgent().getTargetResolution());
             BufferedImage bi = paintToBufferedImage(painter, pclContext,
                     resolution, !pclContext.isColorCanvas(), false);
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLPageDefinition.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLPageDefinition.java?rev=687369&r1=687368&r2=687369&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLPageDefinition.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLPageDefinition.java Wed Aug 20 08:13:56 2008
@@ -24,7 +24,7 @@
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.fop.util.UnitConv;
+import org.apache.xmlgraphics.util.UnitConv;
 
 /**
  * This class represents a page format with PCL-specific properties.
@@ -34,11 +34,11 @@
     private static List pageDefinitions;
     private static PCLPageDefinition defaultPageDefinition;
 
-    private String name;
-    private int selector;
-    private Dimension physicalPageSize;
-    private Rectangle logicalPageRect;
-    private boolean landscape;
+    private final String name;
+    private final int selector;
+    private final Dimension physicalPageSize;
+    private final Rectangle logicalPageRect;
+    private final boolean landscape;
 
     static {
         createPageDefinitions();

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLRenderer.java?rev=687369&r1=687368&r2=687369&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLRenderer.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLRenderer.java Wed Aug 20 08:13:56 2008
@@ -97,7 +97,7 @@
 import org.apache.fop.render.java2d.Java2DRenderer;
 import org.apache.fop.render.pcl.extensions.PCLElementMapping;
 import org.apache.fop.traits.BorderProps;
-import org.apache.fop.util.UnitConv;
+import org.apache.xmlgraphics.util.UnitConv;
 
 /* Note:
  * There are some commonalities with AbstractPathOrientedRenderer but it's not possible
@@ -128,7 +128,7 @@
     protected PCLGenerator gen;
     private boolean ioTrouble = false;
 
-    private Stack graphicContextStack = new Stack();
+    private final Stack graphicContextStack = new Stack();
     private GraphicContext graphicContext = new GraphicContext();
 
     private PCLPageDefinition currentPageDefinition;
@@ -153,7 +153,7 @@
      * This can be used to work around problems with Apache Batik, for example, but setting
      * this to true will increase memory consumption.
      */
-    private boolean useColorCanvas = false;
+    private final boolean useColorCanvas = false;
 
     /**
      * Controls whether the generation of PJL commands gets disabled.
@@ -245,7 +245,7 @@
 
     /** @return the target resolution */
     protected int getResolution() {
-        int resolution = (int)Math.round(userAgent.getTargetResolution());
+        int resolution = Math.round(userAgent.getTargetResolution());
         if (resolution <= 300) {
             return 300;
         } else {
@@ -945,8 +945,8 @@
         int borderPaddingStart = bv.getBorderAndPaddingWidthStart();
         int borderPaddingBefore = bv.getBorderAndPaddingWidthBefore();
         //This is the content-rect
-        float width = (float)bv.getIPD() / 1000f;
-        float height = (float)bv.getBPD() / 1000f;
+        float width = bv.getIPD() / 1000f;
+        float height = bv.getBPD() / 1000f;
 
 
         if (bv.getPositioning() == Block.ABSOLUTE
@@ -1034,7 +1034,7 @@
             currentIPPosition = saveIP;
             currentBPPosition = saveBP;
 
-            currentBPPosition += (int)(bv.getAllocBPD());
+            currentBPPosition += (bv.getAllocBPD());
         }
         //currentFontName = saveFontName;
     }
@@ -1433,13 +1433,13 @@
                  borderRect.width,
                  borderRect.height);
         final Rectangle paintRect = new Rectangle(
-                (int)Math.round(borderRect.x * 1000f),
-                (int)Math.round(borderRect.y * 1000f),
+                Math.round(borderRect.x * 1000f),
+                Math.round(borderRect.y * 1000f),
                 (int)Math.floor(borderRect.width * 1000f) + 1,
                 (int)Math.floor(borderRect.height * 1000f) + 1);
         //Add one pixel wide safety margin around the paint area
         int pixelWidth = (int)Math.round(UnitConv.in2mpt(1) / userAgent.getTargetResolution());
-        final int xoffset = (int)Math.round(-effBorderRect.x * 1000f) + pixelWidth;
+        final int xoffset = Math.round(-effBorderRect.x * 1000f) + pixelWidth;
         final int yoffset = pixelWidth;
         paintRect.x += xoffset;
         paintRect.y += yoffset;

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/txt/TXTRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/txt/TXTRenderer.java?rev=687369&r1=687368&r2=687369&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/txt/TXTRenderer.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/txt/TXTRenderer.java Wed Aug 20 08:13:56 2008
@@ -37,7 +37,7 @@
 import org.apache.fop.render.AbstractPathOrientedRenderer;
 import org.apache.fop.render.txt.border.AbstractBorderElement;
 import org.apache.fop.render.txt.border.BorderManager;
-import org.apache.fop.util.UnitConv;
+import org.apache.xmlgraphics.util.UnitConv;
 
 /**
  * Renderer that renders areas to plain text.
@@ -86,10 +86,10 @@
      * Every line except the last line on a page (which will end with
      * pageEnding) will be terminated with this string.
      */
-    private String lineEnding = "\r\n";
+    private final String lineEnding = "\r\n";
 
     /** Every page except the last one will end with this string. */
-    private String pageEnding = "\f";
+    private final String pageEnding = "\f";
 
     /** Equals true, if current page is first. */
     private boolean firstPage = false;
@@ -101,7 +101,7 @@
     private char fillChar;
 
     /** Saves current coordinate transformation. */
-    private TXTState currentState = new TXTState();
+    private final TXTState currentState = new TXTState();
 
     private String encoding;
 

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/UtilityCodeTestSuite.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/UtilityCodeTestSuite.java?rev=687369&r1=687368&r2=687369&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/UtilityCodeTestSuite.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/UtilityCodeTestSuite.java Wed Aug 20 08:13:56 2008
@@ -22,14 +22,13 @@
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
-import org.apache.fop.pdf.PDFObjectTestCase;
 import org.apache.fop.events.BasicEventTestCase;
+import org.apache.fop.pdf.PDFObjectTestCase;
 import org.apache.fop.traits.BorderPropsTestCase;
+import org.apache.fop.util.ColorUtilTestCase;
 import org.apache.fop.util.DataURIResolverTestCase;
 import org.apache.fop.util.ElementListUtilsTestCase;
 import org.apache.fop.util.PDFNumberTestCase;
-import org.apache.fop.util.ColorUtilTestCase;
-import org.apache.fop.util.UnitConvTestCase;
 import org.apache.fop.util.XMLResourceBundleTestCase;
 
 /**
@@ -47,7 +46,6 @@
         //$JUnit-BEGIN$
         suite.addTest(new TestSuite(PDFNumberTestCase.class));
         suite.addTest(new TestSuite(PDFObjectTestCase.class));
-        suite.addTest(new TestSuite(UnitConvTestCase.class));
         suite.addTest(new TestSuite(ColorUtilTestCase.class));
         suite.addTest(new TestSuite(BorderPropsTestCase.class));
         suite.addTest(new TestSuite(ElementListUtilsTestCase.class));



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org