harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yangl...@apache.org
Subject svn commit: r1006343 - in /harmony/enhanced/java/branches/java6/classlib/modules/imageio/src: main/java/javax/imageio/plugins/jpeg/JPEGQTable.java test/java/javax/imageio/plugins/jpeg/JPEGQTableTest.java
Date Sun, 10 Oct 2010 19:23:05 GMT
Author: yanglang
Date: Sun Oct 10 19:23:05 2010
New Revision: 1006343

URL: http://svn.apache.org/viewvc?rev=1006343&view=rev
Log:
Apply the patch for HARMONY-6672 (JPEGQTable.toString() format is not consistent with RI)
Also have formated the source code a bit. 

Modified:
    harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/main/java/javax/imageio/plugins/jpeg/JPEGQTable.java
    harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/test/java/javax/imageio/plugins/jpeg/JPEGQTableTest.java

Modified: harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/main/java/javax/imageio/plugins/jpeg/JPEGQTable.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/main/java/javax/imageio/plugins/jpeg/JPEGQTable.java?rev=1006343&r1=1006342&r2=1006343&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/main/java/javax/imageio/plugins/jpeg/JPEGQTable.java
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/main/java/javax/imageio/plugins/jpeg/JPEGQTable.java
Sun Oct 10 19:23:05 2010
@@ -27,48 +27,39 @@ public class JPEGQTable {
     private final static int BASELINE_MAX = 255;
     private final static int MAX = 32767;
 
-
     private int[] theTable;
 
     /*
-     * K1 & K2 tables can be found in the JPEG format specification 
-     * at http://www.w3.org/Graphics/JPEG/itu-t81.pdf
+     * K1 & K2 tables can be found in the JPEG format specification at
+     * http://www.w3.org/Graphics/JPEG/itu-t81.pdf
      */
 
-    private static final int[] K1LumTable = new int[] {
-        16,  11,  10,  16,  24,  40,  51,  61,
-        12,  12,  14,  19,  26,  58,  60,  55,
-        14,  13,  16,  24,  40,  57,  69,  56,
-        14,  17,  22,  29,  51,  87,  80,  62,
-        18,  22,  37,  56,  68,  109, 103, 77,
-        24,  35,  55,  64,  81,  104, 113, 92,
-        49,  64,  78,  87,  103, 121, 120, 101,
-        72,  92,  95,  98,  112, 100, 103, 99
-    };
-
-    private static final int[] K2ChrTable = new int[] {
-        17,  18,  24,  47,  99,  99,  99,  99,
-        18,  21,  26,  66,  99,  99,  99,  99,
-        24,  26,  56,  99,  99,  99,  99,  99,
-        47,  66,  99,  99,  99,  99,  99,  99,
-        99,  99,  99,  99,  99,  99,  99,  99,
-        99,  99,  99,  99,  99,  99,  99,  99,
-        99,  99,  99,  99,  99,  99,  99,  99,
-        99,  99,  99,  99,  99,  99,  99,  99
-    };
+    private static final int[] K1LumTable = new int[] { 16, 11, 10, 16, 24, 40,
+            51, 61, 12, 12, 14, 19, 26, 58, 60, 55, 14, 13, 16, 24, 40, 57, 69,
+            56, 14, 17, 22, 29, 51, 87, 80, 62, 18, 22, 37, 56, 68, 109, 103,
+            77, 24, 35, 55, 64, 81, 104, 113, 92, 49, 64, 78, 87, 103, 121,
+            120, 101, 72, 92, 95, 98, 112, 100, 103, 99 };
+
+    private static final int[] K2ChrTable = new int[] { 17, 18, 24, 47, 99, 99,
+            99, 99, 18, 21, 26, 66, 99, 99, 99, 99, 24, 26, 56, 99, 99, 99, 99,
+            99, 47, 66, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
+            99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
+            99, 99, 99, 99, 99, 99, 99 };
 
     public static final JPEGQTable K1Luminance = new JPEGQTable(K1LumTable);
-    public static final JPEGQTable K1Div2Luminance = K1Luminance.getScaledInstance(0.5f,
true);
+    public static final JPEGQTable K1Div2Luminance = K1Luminance
+            .getScaledInstance(0.5f, true);
     public static final JPEGQTable K2Chrominance = new JPEGQTable(K2ChrTable);
-    public static final JPEGQTable K2Div2Chrominance = K2Chrominance.getScaledInstance(0.5f,
true);;
-
+    public static final JPEGQTable K2Div2Chrominance = K2Chrominance
+            .getScaledInstance(0.5f, true);;
 
     public JPEGQTable(int[] table) {
         if (table == null) {
             throw new IllegalArgumentException(Messages.getString("imageio.42"));
         }
         if (table.length != SIZE) {
-                throw new IllegalArgumentException(Messages.getString("imageio.93", table.length));
+            throw new IllegalArgumentException(Messages.getString("imageio.93",
+                    table.length));
         }
         theTable = table.clone();
     }
@@ -97,18 +88,19 @@ public class JPEGQTable {
 
     @Override
     public String toString() {
-    	StringBuilder sb = new StringBuilder();
-    	
-    	sb.append("JPEGQTable:\n");
-    	for (int i = 0; i < 8; i++) {
-    		sb.append('\t');
-    		for (int j = 0; j < 8; j++) {
-    			sb.append(theTable[i*8+j]);
-    			sb.append(' ');
-    		}
-    		sb.append('\n');
-    	}
-    	
+        StringBuilder sb = new StringBuilder();
+
+        sb.append("JPEGQTable:\n");
+        for (int i = 0; i < 8; i++) {
+            sb.append('\t');
+            for (int j = 0; j < 8-1; j++) {
+                sb.append(theTable[i * 8 + j]);
+                sb.append(' ');
+            }
+            sb.append(theTable[i * 8 + 7]);
+            sb.append('\n');
+        }
+
         return sb.toString();
     }
 }

Modified: harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/test/java/javax/imageio/plugins/jpeg/JPEGQTableTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/test/java/javax/imageio/plugins/jpeg/JPEGQTableTest.java?rev=1006343&r1=1006342&r2=1006343&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/test/java/javax/imageio/plugins/jpeg/JPEGQTableTest.java
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/imageio/src/test/java/javax/imageio/plugins/jpeg/JPEGQTableTest.java
Sun Oct 10 19:23:05 2010
@@ -20,30 +20,30 @@ package javax.imageio.plugins.jpeg;
 import junit.framework.TestCase;
 
 public class JPEGQTableTest extends TestCase {
-	
-	public void testToString() {
-		String K1Luminance = "JPEGQTable:\n" +
-							 "\t16 11 10 16 24 40 51 61 \n" +
-							 "\t12 12 14 19 26 58 60 55 \n" +
-							 "\t14 13 16 24 40 57 69 56 \n" +
-							 "\t14 17 22 29 51 87 80 62 \n" +
-							 "\t18 22 37 56 68 109 103 77 \n" +
-							 "\t24 35 55 64 81 104 113 92 \n" +
-							 "\t49 64 78 87 103 121 120 101 \n" +
-							 "\t72 92 95 98 112 100 103 99 \n";
-		
-		String K2Chrominance = "JPEGQTable:\n" +
-							   "\t17 18 24 47 99 99 99 99 \n" +
-							   "\t18 21 26 66 99 99 99 99 \n" +
-							   "\t24 26 56 99 99 99 99 99 \n" +
-							   "\t47 66 99 99 99 99 99 99 \n" +
-							   "\t99 99 99 99 99 99 99 99 \n" +
-							   "\t99 99 99 99 99 99 99 99 \n" +
-							   "\t99 99 99 99 99 99 99 99 \n" +
-							   "\t99 99 99 99 99 99 99 99 \n";
-						 
-		assertEquals(K1Luminance, JPEGQTable.K1Luminance.toString());
-		assertEquals(K2Chrominance, JPEGQTable.K2Chrominance.toString());
-	}
-	
+
+    public void testToString() {
+        String K1Luminance = "JPEGQTable:\n" 
+                + "\t16 11 10 16 24 40 51 61\n"
+                + "\t12 12 14 19 26 58 60 55\n" 
+                + "\t14 13 16 24 40 57 69 56\n"
+                + "\t14 17 22 29 51 87 80 62\n"
+                + "\t18 22 37 56 68 109 103 77\n"
+                + "\t24 35 55 64 81 104 113 92\n"
+                + "\t49 64 78 87 103 121 120 101\n"
+                + "\t72 92 95 98 112 100 103 99\n";
+
+        String K2Chrominance = "JPEGQTable:\n" 
+                + "\t17 18 24 47 99 99 99 99\n"
+                + "\t18 21 26 66 99 99 99 99\n" 
+                + "\t24 26 56 99 99 99 99 99\n"
+                + "\t47 66 99 99 99 99 99 99\n" 
+                + "\t99 99 99 99 99 99 99 99\n"
+                + "\t99 99 99 99 99 99 99 99\n" 
+                + "\t99 99 99 99 99 99 99 99\n"
+                + "\t99 99 99 99 99 99 99 99\n";
+
+        assertEquals(K1Luminance, JPEGQTable.K1Luminance.toString());
+        assertEquals(K2Chrominance, JPEGQTable.K2Chrominance.toString());
+    }
+
 }



Mime
View raw message