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 ga...@apache.org on 2012/04/29 19:00:36 UTC
svn commit: r1331950 - in /xmlgraphics/fop/trunk: ./ lib/
src/java/org/apache/fop/pdf/ src/java/org/apache/fop/render/intermediate/
src/java/org/apache/fop/util/
Author: gadams
Date: Sun Apr 29 17:00:36 2012
New Revision: 1331950
URL: http://svn.apache.org/viewvc?rev=1331950&view=rev
Log:
Bugzilla #43940: Use new double format utility to improve thread safety and performance. Submitted by Julien Aymé, Ognjen Blagojevic.
Removed:
xmlgraphics/fop/trunk/src/java/org/apache/fop/util/DecimalFormatCache.java
Modified:
xmlgraphics/fop/trunk/lib/xmlgraphics-commons-1.5svn.jar
xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFColorHandler.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFNumber.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/IFUtil.java
xmlgraphics/fop/trunk/status.xml
Modified: xmlgraphics/fop/trunk/lib/xmlgraphics-commons-1.5svn.jar
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/lib/xmlgraphics-commons-1.5svn.jar?rev=1331950&r1=1331949&r2=1331950&view=diff
==============================================================================
Binary files - no diff available.
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFColorHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFColorHandler.java?rev=1331950&r1=1331949&r2=1331950&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFColorHandler.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFColorHandler.java Sun Apr 29 17:00:36 2012
@@ -23,7 +23,6 @@ import java.awt.Color;
import java.awt.color.ColorSpace;
import java.awt.color.ICC_ColorSpace;
import java.awt.color.ICC_Profile;
-import java.text.DecimalFormat;
import java.util.Map;
import org.apache.commons.logging.Log;
@@ -36,7 +35,7 @@ import org.apache.xmlgraphics.java2d.col
import org.apache.xmlgraphics.java2d.color.NamedColorSpace;
import org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil;
-import org.apache.fop.util.DecimalFormatCache;
+import org.apache.xmlgraphics.util.DoubleFormatUtil;
/**
* This class handles the registration of color spaces and the generation of PDF code to select
@@ -225,9 +224,9 @@ public class PDFColorHandler {
if (comps.length != componentCount) {
throw new IllegalStateException("Color with unexpected component count encountered");
}
- DecimalFormat df = DecimalFormatCache.getDecimalFormat(4);
for (int i = 0, c = comps.length; i < c; i++) {
- codeBuffer.append(df.format(comps[i])).append(" ");
+ DoubleFormatUtil.formatDouble(comps[i], 4, 4, codeBuffer);
+ codeBuffer.append(" ");
}
codeBuffer.append(command).append("\n");
}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFNumber.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFNumber.java?rev=1331950&r1=1331949&r2=1331950&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFNumber.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFNumber.java Sun Apr 29 17:00:36 2012
@@ -19,7 +19,7 @@
package org.apache.fop.pdf;
-import org.apache.fop.util.DecimalFormatCache;
+import org.apache.xmlgraphics.util.DoubleFormatUtil;
/**
* This class represents a simple number object. It also contains contains some
@@ -75,7 +75,12 @@ public class PDFNumber extends PDFObject
* @return the value as a string
*/
public static String doubleOut(double doubleDown, int dec) {
- return DecimalFormatCache.getDecimalFormat(dec).format(doubleDown);
+ if (dec < 0 || dec > 16) {
+ throw new IllegalArgumentException("Parameter dec must be between 1 and 16");
+ }
+ StringBuffer buf = new StringBuffer();
+ DoubleFormatUtil.formatDouble(doubleDown, dec, dec, buf);
+ return buf.toString();
}
/** {@inheritDoc} */
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/IFUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/IFUtil.java?rev=1331950&r1=1331949&r2=1331950&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/IFUtil.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/IFUtil.java Sun Apr 29 17:00:36 2012
@@ -22,9 +22,10 @@ package org.apache.fop.render.intermedia
import java.awt.Rectangle;
import java.awt.geom.AffineTransform;
+import org.apache.xmlgraphics.util.DoubleFormatUtil;
+
import org.apache.fop.apps.FOPException;
import org.apache.fop.fonts.FontInfo;
-import org.apache.fop.util.DecimalFormatCache;
/**
* Utility functions for the intermediate format.
@@ -40,7 +41,9 @@ public final class IFUtil {
//See http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.2.3
value = 0.0;
}
- return DecimalFormatCache.getDecimalFormat(6).format(value);
+ StringBuffer buf = new StringBuffer();
+ DoubleFormatUtil.formatDouble(value, 6, 6, buf);
+ return buf.toString();
}
/**
Modified: xmlgraphics/fop/trunk/status.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/status.xml?rev=1331950&r1=1331949&r2=1331950&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/status.xml (original)
+++ xmlgraphics/fop/trunk/status.xml Sun Apr 29 17:00:36 2012
@@ -63,6 +63,9 @@
documents. Example: the fix of marks layering will be such a case when it's done.
-->
<release version="FOP Trunk" date="TBD">
+ <action context="Code" dev="GA" type="fix" fixes-bug="43940" due-to="Julien Aymé, Ognjen Blagojevic">
+ Use new double format utility to improve thread safety and performance.
+ </action>
<action context="Fonts" dev="GA" type="fix" fixes-bug="53148" due-to="Tassos Charoulis">
Fix performance regression in JDK 1.6 Update 19 due to use of Java Beans API. Fix checkstyle errors.
</action>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org