xmlgraphics-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vhenneb...@apache.org
Subject svn commit: r1352939 [3/3] - in /xmlgraphics/commons/branches/Temp_TrueTypeInPostScript: ./ src/java/org/apache/xmlgraphics/fonts/ src/java/org/apache/xmlgraphics/image/ src/java/org/apache/xmlgraphics/image/codec/png/ src/java/org/apache/xmlgraphics/i...
Date Fri, 22 Jun 2012 15:55:19 GMT
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/ASCII85Constants.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/ASCII85Constants.java?rev=1352939&r1=1352938&r2=1352939&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/ASCII85Constants.java
(original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/ASCII85Constants.java
Fri Jun 22 15:55:07 2012
@@ -27,30 +27,30 @@ package org.apache.xmlgraphics.util.io;
 public interface ASCII85Constants {
 
     /** Special character "z" stands for four NULL bytes (short-cut for !!!!!) */
-    public static final int ZERO          = 0x7A; //"z"
+    int ZERO          = 0x7A; //"z"
     /** ZERO as a byte array */
-    public static final byte[] ZERO_ARRAY = {(byte)ZERO};
+    byte[] ZERO_ARRAY = {(byte)ZERO};
     /** The start index for ASCII85 characters (!) */
-    public static final int START         = 0x21; //"!"
+    int START         = 0x21; //"!"
     /** The end index for ASCII85 characters (u) */
-    public static final int END           = 0x75; //"u"
+    int END           = 0x75; //"u"
     /** The EOL indicator (LF) */
-    public static final int EOL           = 0x0A; //"\n"
+    int EOL           = 0x0A; //"\n"
     /** The EOD (end of data) indicator */
-    public static final byte[] EOD        = {0x7E, 0x3E}; //"~>"
+    byte[] EOD        = {0x7E, 0x3E}; //"~>"
 
     /** Array of powers of 85 (4, 3, 2, 1, 0) */
-    public static final long POW85[] = new long[] {85 * 85 * 85 * 85,
+    long[] POW85 = new long[] {85 * 85 * 85 * 85,
                                                     85 * 85 * 85,
                                                     85 * 85,
                                                     85,
                                                     1};
 
     /*
-    public static final long BASE85_4 = 85;
-    public static final long BASE85_3 = BASE85_4 * BASE85_4;
-    public static final long BASE85_2 = BASE85_3 * BASE85_4;
-    public static final long BASE85_1 = BASE85_2 * BASE85_4;
+    long BASE85_4 = 85;
+    long BASE85_3 = BASE85_4 * BASE85_4;
+    long BASE85_2 = BASE85_3 * BASE85_4;
+    long BASE85_1 = BASE85_2 * BASE85_4;
     */
 
 }

Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/ASCII85InputStream.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/ASCII85InputStream.java?rev=1352939&r1=1352938&r2=1352939&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/ASCII85InputStream.java
(original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/ASCII85InputStream.java
Fri Jun 22 15:55:07 2012
@@ -19,8 +19,8 @@
 
 package org.apache.xmlgraphics.util.io;
 
-import java.io.InputStream;
 import java.io.IOException;
+import java.io.InputStream;
 
 /**
  * This class applies a ASCII85 decoding to the stream.

Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/ASCII85OutputStream.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/ASCII85OutputStream.java?rev=1352939&r1=1352938&r2=1352939&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/ASCII85OutputStream.java
(original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/ASCII85OutputStream.java
Fri Jun 22 15:55:07 2012
@@ -19,9 +19,9 @@
 
 package org.apache.xmlgraphics.util.io;
 
-import java.io.OutputStream;
 import java.io.FilterOutputStream;
 import java.io.IOException;
+import java.io.OutputStream;
 
 /**
  * This class applies a ASCII85 encoding to the stream.
@@ -92,7 +92,8 @@ public class ASCII85OutputStream extends
             if (firstpart > 0) {
                 out.write(buf, 0, firstpart);
             }
-            out.write(EOL); bw++;
+            out.write(EOL);
+            bw++;
             int rest = len - firstpart;
             if (rest > 0) {
                 out.write(buf, firstpart, rest);

Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/ASCIIHexOutputStream.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/ASCIIHexOutputStream.java?rev=1352939&r1=1352938&r2=1352939&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/ASCIIHexOutputStream.java
(original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/ASCIIHexOutputStream.java
Fri Jun 22 15:55:07 2012
@@ -19,9 +19,9 @@
 
 package org.apache.xmlgraphics.util.io;
 
-import java.io.OutputStream;
 import java.io.FilterOutputStream;
 import java.io.IOException;
+import java.io.OutputStream;
 
 /**
  * This class applies a ASCII Hex encoding to the stream.

Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/Base64DecodeStream.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/Base64DecodeStream.java?rev=1352939&r1=1352938&r2=1352939&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/Base64DecodeStream.java
(original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/Base64DecodeStream.java
Fri Jun 22 15:55:07 2012
@@ -22,6 +22,13 @@ package org.apache.xmlgraphics.util.io;
 import java.io.IOException;
 import java.io.InputStream;
 
+// CSOFF: ConstantName
+// CSOFF: MemberName
+// CSOFF: MultipleVariableDeclarations
+// CSOFF: NeedBraces
+// CSOFF: OperatorWrap
+// CSOFF: WhitespaceAround
+
 /**
  * This class implements a Base64 Character decoder as specified in RFC1113.
  * Unlike some other encoding schemes there is nothing in this encoding that
@@ -42,10 +49,9 @@ import java.io.InputStream;
  *    "Base64DecodeStream: Bad Padding byte (1)."
  * </pre>
  *
- * @author <a href="mailto:thomas.deweese@kodak.com">Thomas DeWeese</a>
- * @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
- * @author      Chuck McManis
  * @version $Id$
+ *
+ * Originally authored by Thomas DeWeese, Vincent Hardy, and Chuck McManis.
  */
 
 public class Base64DecodeStream extends InputStream {
@@ -56,7 +62,7 @@ public class Base64DecodeStream extends 
         this.src = src;
     }
 
-    private static final byte pem_array[] = new byte[256];
+    private static final byte[] pem_array = new byte[256];
     static {
         for (int i=0; i<pem_array.length; i++)
             pem_array[i] = -1;
@@ -89,8 +95,8 @@ public class Base64DecodeStream extends 
         return 3-out_offset;
     }
 
-    byte decode_buffer[] = new byte[4];
-    byte out_buffer[] = new byte[3];
+    byte[] decode_buffer = new byte[4];
+    byte[] out_buffer = new byte[3];
     int  out_offset = 3;
     boolean EOF = false;
 

Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/Base64EncodeStream.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/Base64EncodeStream.java?rev=1352939&r1=1352938&r2=1352939&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/Base64EncodeStream.java
(original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/Base64EncodeStream.java
Fri Jun 22 15:55:07 2012
@@ -23,6 +23,14 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.io.PrintStream;
 
+// CSOFF: ConstantName
+// CSOFF: InnerAssignment
+// CSOFF: MultipleVariableDeclarations
+// CSOFF: NeedBraces
+// CSOFF: OneStatementPerLine
+// CSOFF: WhitespaceAfter
+// CSOFF: WhitespaceAround
+
 /**
  * This class implements a Base64 Character encoder as specified in RFC1113.
  * Unlike some other encoding schemes there is nothing in this encoding
@@ -31,15 +39,14 @@ import java.io.PrintStream;
  * This means that the encoded text will simply start with the first line
  * of encoded text and end with the last line of encoded text.
  *
- * @author <a href="mailto:deweese@apache.org">Thomas DeWeese</a>
- * @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
- * @author      Chuck McManis
  * @version $Id$
+ *
+ * Originally authored by Thomas DeWeese, Vincent Hardy, and Chuck McManis.
  */
 public class Base64EncodeStream extends OutputStream {
 
     /** This array maps the 6 bit values to their characters */
-    private final static byte pem_array[] = {
+    private static final byte[] pem_array = {
     //   0   1   2   3   4   5   6   7
         'A','B','C','D','E','F','G','H', // 0
         'I','J','K','L','M','N','O','P', // 1

Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/RunLengthEncodeOutputStream.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/RunLengthEncodeOutputStream.java?rev=1352939&r1=1352938&r2=1352939&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/RunLengthEncodeOutputStream.java
(original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/io/RunLengthEncodeOutputStream.java
Fri Jun 22 15:55:07 2012
@@ -20,15 +20,16 @@
 package org.apache.xmlgraphics.util.io;
 
 import java.io.FilterOutputStream;
-import java.io.OutputStream;
 import java.io.IOException;
+import java.io.OutputStream;
 
 
 /**
  * This class applies a RunLengthEncode filter to the stream.
  *
- * @author   <a href="mailto:smwolke@geistig.com">Stephen Wolke</a>
  * @version  $Id$
+ *
+ * Originally authored by Stephen Wolke.
  */
 public class RunLengthEncodeOutputStream extends FilterOutputStream
             implements Finalizable {
@@ -97,17 +98,6 @@ public class RunLengthEncodeOutputStream
             break;
         default:
             switch (isSequence) {
-            case IN_SEQUENCE:
-                if (runBuffer[runCount] != runBuffer[runCount - 1]) {
-                    out.write(BYTE_MAX - (runCount - 1));
-                    out.write(runBuffer[runCount - 1]);
-                    runBuffer[0] = runBuffer[runCount];
-                    runCount = 1;
-                    isSequence = NOT_IDENTIFY_SEQUENCE;
-                    break;
-                }
-                runCount++;
-                break;
             case NOT_IN_SEQUENCE:
                 if (runBuffer[runCount] == runBuffer[runCount - 1]) {
                     isSequence = START_SEQUENCE;
@@ -129,6 +119,18 @@ public class RunLengthEncodeOutputStream
                     runCount++;
                     break;
                 }
+            case IN_SEQUENCE:
+            default:
+                if (runBuffer[runCount] != runBuffer[runCount - 1]) {
+                    out.write(BYTE_MAX - (runCount - 1));
+                    out.write(runBuffer[runCount - 1]);
+                    runBuffer[0] = runBuffer[runCount];
+                    runCount = 1;
+                    isSequence = NOT_IDENTIFY_SEQUENCE;
+                    break;
+                }
+                runCount++;
+                break;
             }
         }
     }

Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/uri/CommonURIResolver.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/uri/CommonURIResolver.java?rev=1352939&r1=1352938&r2=1352939&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/uri/CommonURIResolver.java
(original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/uri/CommonURIResolver.java
Fri Jun 22 15:55:07 2012
@@ -41,7 +41,7 @@ public class CommonURIResolver implement
 
     private final List uriResolvers = new LinkedList();
 
-    private final static class DefaultInstanceHolder {
+    private static final class DefaultInstanceHolder {
         private static final CommonURIResolver INSTANCE = new CommonURIResolver();
     }
 

Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/uri/DataURIResolver.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/uri/DataURIResolver.java?rev=1352939&r1=1352938&r2=1352939&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/uri/DataURIResolver.java
(original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/uri/DataURIResolver.java
Fri Jun 22 15:55:07 2012
@@ -30,6 +30,7 @@ import javax.xml.transform.stream.Stream
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.apache.xmlgraphics.util.io.Base64DecodeStream;
 
 /**
@@ -41,7 +42,7 @@ import org.apache.xmlgraphics.util.io.Ba
 public class DataURIResolver implements URIResolver {
 
     /** logger */
-    private static Log LOG = LogFactory.getLog(URIResolver.class);
+    private static final Log LOG = LogFactory.getLog(URIResolver.class);
 
 
     /**

Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/uri/DataURLUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/uri/DataURLUtil.java?rev=1352939&r1=1352938&r2=1352939&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/uri/DataURLUtil.java
(original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/uri/DataURLUtil.java
Fri Jun 22 15:55:07 2012
@@ -32,7 +32,10 @@ import org.apache.xmlgraphics.util.io.Ba
 /**
  * Utility classes for generating RFC 2397 data URLs.
  */
-public class DataURLUtil {
+public final class DataURLUtil {
+
+    private DataURLUtil() {
+    }
 
     /**
      * Creates a new data URL and returns it as a String.

Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/PropertyAccess.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/PropertyAccess.java?rev=1352939&r1=1352938&r2=1352939&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/PropertyAccess.java
(original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/PropertyAccess.java
Fri Jun 22 15:55:07 2012
@@ -74,4 +74,4 @@ public interface PropertyAccess {
      */
     Iterator iterator();
 
-}
\ No newline at end of file
+}

Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPHandler.java?rev=1352939&r1=1352938&r2=1352939&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPHandler.java
(original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPHandler.java
Fri Jun 22 15:55:07 2012
@@ -51,11 +51,7 @@ public class XMPHandler extends DefaultH
 
     private boolean hasComplexContent() {
         Object obj = this.contextStack.peek();
-        if (obj instanceof QName) {
-            return false;
-        } else {
-            return true;
-        }
+        return !(obj instanceof QName);
     }
 
     private PropertyAccess getCurrentProperties() {

Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPPacketParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPPacketParser.java?rev=1352939&r1=1352938&r2=1352939&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPPacketParser.java
(original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPPacketParser.java
Fri Jun 22 15:55:07 2012
@@ -37,7 +37,10 @@ import org.apache.commons.io.output.Byte
  * Important: Before you use this class to look for an XMP packet in some random file, please
read
  * the chapter on "Scanning Files for XMP Packets" in the XMP specification!
  */
-public class XMPPacketParser {
+public final class XMPPacketParser {
+
+    private XMPPacketParser() {
+    }
 
     private static final byte[] PACKET_HEADER;
     private static final byte[] PACKET_HEADER_END;

Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPParser.java?rev=1352939&r1=1352938&r2=1352939&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPParser.java
(original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPParser.java
Fri Jun 22 15:55:07 2012
@@ -31,7 +31,10 @@ import javax.xml.transform.stream.Stream
 /**
  * The XMP parser.
  */
-public class XMPParser {
+public final class XMPParser {
+
+    private XMPParser() {
+    }
 
     /**
      * Parses an XMP file.

Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPSchemaRegistry.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPSchemaRegistry.java?rev=1352939&r1=1352938&r2=1352939&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPSchemaRegistry.java
(original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPSchemaRegistry.java
Fri Jun 22 15:55:07 2012
@@ -29,7 +29,7 @@ import org.apache.xmlgraphics.xmp.schema
 /**
  * This class is a registry of XMP schemas. It's implemented as a singleton.
  */
-public class XMPSchemaRegistry {
+public final class XMPSchemaRegistry {
 
     private static XMPSchemaRegistry instance = null;
 

Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPSerializer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPSerializer.java?rev=1352939&r1=1352938&r2=1352939&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPSerializer.java
(original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPSerializer.java
Fri Jun 22 15:55:07 2012
@@ -34,7 +34,10 @@ import org.xml.sax.SAXException;
 /**
  * Serializes an XMP tree to XML or to an XMP packet.
  */
-public class XMPSerializer {
+public final class XMPSerializer {
+
+    private XMPSerializer() {
+    }
 
     private static final String DEFAULT_ENCODING = "UTF-8";
 

Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/resources/META-INF/services/org.apache.xmlgraphics.image.loader.spi.ImageLoaderFactory
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/resources/META-INF/services/org.apache.xmlgraphics.image.loader.spi.ImageLoaderFactory?rev=1352939&r1=1352938&r2=1352939&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/resources/META-INF/services/org.apache.xmlgraphics.image.loader.spi.ImageLoaderFactory
(original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/resources/META-INF/services/org.apache.xmlgraphics.image.loader.spi.ImageLoaderFactory
Fri Jun 22 15:55:07 2012
@@ -2,4 +2,5 @@ org.apache.xmlgraphics.image.loader.impl
 org.apache.xmlgraphics.image.loader.impl.ImageLoaderFactoryRaw
 org.apache.xmlgraphics.image.loader.impl.ImageLoaderFactoryRawCCITTFax
 org.apache.xmlgraphics.image.loader.impl.ImageLoaderFactoryEPS
-org.apache.xmlgraphics.image.loader.impl.ImageLoaderFactoryInternalTIFF
\ No newline at end of file
+org.apache.xmlgraphics.image.loader.impl.ImageLoaderFactoryInternalTIFF
+org.apache.xmlgraphics.image.loader.impl.ImageLoaderFactoryPNG
\ No newline at end of file

Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/status.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/status.xml?rev=1352939&r1=1352938&r2=1352939&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/status.xml (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/status.xml Fri Jun 22 15:55:07
2012
@@ -41,6 +41,27 @@
   </contexts>
   <changes>
     <release version="Trunk" date="n/a">
+      <action context="Code" dev="GA" type="fix" fixes-bug="53408" due-to="Luis Bernardo,
Matthias Reischenbacher">
+        Add two PNG image loaders, one using internal XGC PNG code, the other using an externally
supplied IDAT chunk (for raw decoding).
+      </action>
+      <action context="Code" dev="GA" type="update" fixes-bug="53327" due-to="Julien Aymé">
+        Fix corner cases involving long/double conversion and rounding error in double division
when rounding 5E-N for certain N.
+      </action>
+      <action context="Code" dev="GA" type="update" fixes-bug="53327" due-to="Julien Aymé">
+        Fix determination of use of precise vs fast formatting in order to fix regression
with value 5.22534294505995E-4, decimals: 17, precision: 17.
+      </action>
+      <action context="Code" dev="GA" type="fix" fixes-bug="53352">
+        Upgrade to checkstyle-5.5 and ensure no warnings.
+      </action>
+      <action context="Code" dev="GA" type="fix" fixes-bug="51149" due-to="Luis Bernardo">
+        Improve performance for certain kinds of PNG images.
+      </action>
+      <action context="Code" dev="GA" type="fix" fixes-bug="53327" due-to="Julien Aymé">
+        Fix handling of values less than 1E-300.
+      </action>
+      <action context="Code" dev="GA" type="update" fixes-bug="43940" due-to="Julien Aymé">
+        Fix handling of NaN, {+,-}Infinity, and other edge cases.
+      </action>
       <action context="Code" dev="GA" type="fix" fixes-bug="53184" due-to="Robert Meyer">
         Unify date formatting between FOP and XGC as well as tidying the date format code.
       </action>

Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/test/java/org/apache/xmlgraphics/image/loader/ImageLoaderTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/test/java/org/apache/xmlgraphics/image/loader/ImageLoaderTestCase.java?rev=1352939&r1=1352938&r2=1352939&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/test/java/org/apache/xmlgraphics/image/loader/ImageLoaderTestCase.java
(original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/test/java/org/apache/xmlgraphics/image/loader/ImageLoaderTestCase.java
Fri Jun 22 15:55:07 2012
@@ -34,6 +34,9 @@ import javax.xml.transform.stream.Stream
 import junit.framework.TestCase;
 
 import org.apache.commons.io.IOUtils;
+
+import org.apache.xmlgraphics.image.loader.impl.ImageLoaderPNG;
+import org.apache.xmlgraphics.image.loader.impl.ImageLoaderRawPNG;
 import org.apache.xmlgraphics.image.loader.impl.ImageRawStream;
 import org.apache.xmlgraphics.image.loader.impl.ImageRendered;
 import org.apache.xmlgraphics.image.loader.spi.ImageImplRegistry;
@@ -186,11 +189,15 @@ public class ImageLoaderTestCase extends
             String mime, ImageFlavor rawFlavor) throws Exception {
         ImageLoaderFactory ilfs[] = ImageImplRegistry.getDefaultInstance()
                 .getImageLoaderFactories(mime);
-        if (ilfs != null)
+        if (ilfs != null) {
             for (int i = 0; i < ilfs.length; i++) {
                 ImageLoaderFactory ilf = ilfs[i];
                 try {
                     final ImageLoader il = ilf.newImageLoader(rawFlavor);
+                    if (il instanceof ImageLoaderRawPNG || il instanceof ImageLoaderPNG)
{
+                        // temporary measure until ImageLoaderRawPNG and ImageLoader PNG
handle ICC profiles
+                        continue;
+                    }
                     final ImageInfo im = new ImageInfo(uri, mime);
                     final Image img = il.loadImage(im, isc);
                     final ICC_Profile icc = img.getICCProfile();
@@ -203,8 +210,7 @@ public class ImageLoaderTestCase extends
                     // Ignore. This imageLoader does not support RAW
                 }
                 try {
-                    final ImageLoader il = ilf
-                            .newImageLoader(ImageFlavor.BUFFERED_IMAGE);
+                    final ImageLoader il = ilf.newImageLoader(ImageFlavor.BUFFERED_IMAGE);
                     final ImageInfo im = new ImageInfo(uri, mime);
                     final Image img = il.loadImage(im, isc);
                     final ICC_Profile icc = img.getICCProfile();
@@ -213,6 +219,7 @@ public class ImageLoaderTestCase extends
                     // Ignore. This imageLoader does not support Buffered.
                 }
             }
+        }
     }
 
     public void testBrokenIccPng() throws Exception {

Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/test/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2DTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/test/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2DTestCase.java?rev=1352939&r1=1352938&r2=1352939&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/test/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2DTestCase.java
(original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/test/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2DTestCase.java
Fri Jun 22 15:55:07 2012
@@ -1,6 +1,5 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
-
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0

Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/test/java/org/apache/xmlgraphics/util/DoubleFormatUtilTest.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/test/java/org/apache/xmlgraphics/util/DoubleFormatUtilTest.java?rev=1352939&r1=1352938&r2=1352939&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/test/java/org/apache/xmlgraphics/util/DoubleFormatUtilTest.java
(original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/test/java/org/apache/xmlgraphics/util/DoubleFormatUtilTest.java
Fri Jun 22 15:55:07 2012
@@ -118,6 +118,127 @@ public class DoubleFormatUtilTest extend
         expected = "0.00002";
         actual = format(value, decimals, precision);
         assertEquals(value, decimals, precision, expected, actual);
+
+        // Test added after bug #43940 was reopened
+        value = 0.005859375;
+        expected = "0.00585938";
+        actual = format(value, 8, 8);
+        assertEquals(value, 8, 8, expected, actual);
+
+        value = 5.22534294505995E-4;
+        expected = "0.000522534294506";
+        actual = format(value, 17, 17);
+        assertEquals(value, 17, 17, expected, actual);
+
+        value = 4.9E-324;
+        expected = "0";
+        actual = format(value, 309, 309);
+        assertEquals(value, 309, 309, expected, actual);
+
+        value = 7.003868765287485E-280;
+        expected = refFormat(value, 294, 294);
+        actual = format(value, 294, 294);
+        assertEquals(value, 294, 294, expected, actual);
+
+        value = 5E-304;
+        expected = refFormat(value, 303, 303);
+        actual = format(value, 303, 303);
+        assertEquals(value, 303, 303, expected, actual);
+
+        value = 9.999999999999999E-250;
+        expected = refFormat(value, 265, 265);
+        actual = format(value, 265, 265);
+        assertEquals(value, 265, 265, expected, actual);
+    }
+
+    public void testLimits() {
+        int decimals = 19;
+        int precision = 19;
+
+        double value = Double.NaN;
+        String expected = "NaN";
+        String actual = format(value, decimals, precision);
+        assertEquals(value, decimals, precision, expected, actual);
+
+        value = Double.POSITIVE_INFINITY;
+        expected = "Infinity";
+        actual = format(value, decimals, precision);
+        assertEquals(value, decimals, precision, expected, actual);
+
+        value = Double.NEGATIVE_INFINITY;
+        expected = "-Infinity";
+        actual = format(value, decimals, precision);
+        assertEquals(value, decimals, precision, expected, actual);
+
+        value = 1e-3 + Double.MIN_VALUE;
+        expected = "0.001";
+        actual = format(value, decimals, precision);
+        assertEquals(value, decimals, precision, expected, actual);
+
+        value = 1e-3 - Double.MIN_VALUE;
+        expected = "0.001";
+        actual = format(value, decimals, precision);
+        assertEquals(value, decimals, precision, expected, actual);
+
+        value = 1e-3;
+        expected = "0.001";
+        actual = format(value, decimals, precision);
+        assertEquals(value, decimals, precision, expected, actual);
+
+        value = 0.0010000000000000002; // == Math.nextAfter(1e-3, Double.POSITIVE_INFINITY);
+        expected = "0.0010000000000000002";
+        actual = format(value, decimals, precision);
+        assertEquals(value, decimals, precision, expected, actual);
+        expected = "0.001";
+        actual = format(value, 18, 18);
+        assertEquals(value, 18, 18, expected, actual);
+
+        value = 0.0009999999999999998; // == Math.nextAfter(1e-3, Double.NEGATIVE_INFINITY);
+        expected = "0.0009999999999999998";
+        actual = format(value, decimals, precision);
+        assertEquals(value, decimals, precision, expected, actual);
+        expected = "0.001";
+        actual = format(value, 18, 18);
+        assertEquals(value, 18, 18, expected, actual);
+
+        value = 1e7 + Double.MIN_VALUE;
+        expected = "10000000";
+        actual = format(value, decimals, precision);
+        assertEquals(value, decimals, precision, expected, actual);
+
+        value = 1e7 - Double.MIN_VALUE;
+        expected = "10000000";
+        actual = format(value, decimals, precision);
+        assertEquals(value, decimals, precision, expected, actual);
+
+        value = 1e7;
+        expected = "10000000";
+        actual = format(value, decimals, precision);
+        assertEquals(value, decimals, precision, expected, actual);
+
+        value = 1.0000000000000002E7; // == Math.nextAfter(1e7, Double.POSITIVE_INFINITY);
+        expected = "10000000.000000002";
+        actual = format(value, decimals, precision);
+        assertEquals(value, decimals, precision, expected, actual);
+        expected = "10000000";
+        actual = format(value, 8, 8);
+        assertEquals(value, 8, 8, expected, actual);
+
+        value = 9999999.999999998; // == Math.nextAfter(1e7, Double.NEGATIVE_INFINITY);
+        expected = "9999999.999999998";
+        actual = format(value, decimals, precision);
+        assertEquals(value, decimals, precision, expected, actual);
+        expected = "10000000";
+        actual = format(value, 8, 8);
+        assertEquals(value, 8, 8, expected, actual);
+
+        value = 0.000009999999999999997; // Check higher precision
+        expected = "0.000009999999999999997";
+        actual = format(value, 21, 21);
+        assertEquals(value, 21, 21, expected, actual);
+        expected = "0.00001";
+        actual = format(value, 20, 20);
+        assertEquals(value, 20, 20, expected, actual);
     }
 
     /**
@@ -164,6 +285,9 @@ public class DoubleFormatUtilTest extend
      * whereas DecimalFormat may have some formating errors regarding the last digit.
      */
     private String refFormat(double value, int decimals, int precision) {
+        if (Double.isNaN(value) || Double.isInfinite(value)) {
+            return Double.toString(value);
+        }
         buf.setLength(0);
         BigDecimal bg = new BigDecimal(Double.toString(value));
         int scale = Math.abs(value) < 1.0 ? precision : decimals;
@@ -313,8 +437,8 @@ public class DoubleFormatUtilTest extend
 
         double value, highValue, lowValue;
         long start = System.currentTimeMillis();
-        int nbTest = 100000;
-        int maxDecimals = 10;
+        int nbTest = 1000000;
+        int maxDecimals = 16;
 
         r.setSeed(seed);
         start = System.currentTimeMillis();
@@ -419,4 +543,38 @@ public class DoubleFormatUtilTest extend
         long toStringDuration = System.currentTimeMillis() - start;
         System.out.println("toString duration: " + toStringDuration + "ms to format " + (3
* nbTest) + " doubles");
     }
+
+    public void testAllDoubleRanges() {
+        double[] values = {0, 1, 5, 4.9999, 5.0001, 9.9999, 1234567890, 0 /* The last one
is random */};
+        Random r = new Random();
+        double value;
+        String expected, actual;
+        int minScale, maxScale;
+        for (int i = -330; i <= 315; i++) {
+            values[values.length - 1] = r.nextDouble();
+            double pow = Math.pow(10.0, i);
+            for (double d : values) {
+                value = d * pow;
+                minScale = 1;
+                maxScale = 350;
+                // Reduce scales (unnecessary tests)
+                if (i < -30) {
+                    minScale = -i - 30;
+                    maxScale = -i + 30;
+                } else if (i <= 0) {
+                    minScale = 1;
+                    maxScale = -i + 30;
+                } else {
+                    minScale = 1;
+                    maxScale = 30;
+                }
+                for (int scale = minScale; scale <= maxScale; scale++) {
+                    expected = refFormat(value, scale, scale);
+                    actual = format(value, scale, scale);
+                    assertEquals(value, scale, scale, expected, actual);
+                }
+            }
+            
+        }
+    }
 }



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


Mime
View raw message