Added error correction level to Result
[zxing.git] / core / src / com / google / zxing / qrcode / decoder / Decoder.java
index 0ee7954..26394e5 100644 (file)
@@ -27,7 +27,7 @@ import com.google.zxing.common.reedsolomon.ReedSolomonException;
  * <p>The main class which implements QR Code decoding -- as opposed to locating and extracting\r
  * the QR Code from an image.</p>\r
  *\r
- * @author srowen@google.com (Sean Owen)\r
+ * @author Sean Owen\r
  */\r
 public final class Decoder {\r
 \r
@@ -51,7 +51,7 @@ public final class Decoder {
     for (int i = 0; i < dimension; i++) {\r
       for (int j = 0; j < dimension; j++) {\r
         if (image[i][j]) {\r
-          bits.set(i, j);\r
+          bits.set(j, i);\r
         }\r
       }\r
     }\r
@@ -97,8 +97,7 @@ public final class Decoder {
     }\r
 \r
     // Decode the contents of that stream of bytes\r
-    String text = DecodedBitStreamParser.decode(resultBytes, version);\r
-    return new DecoderResult(resultBytes, text);\r
+    return DecodedBitStreamParser.decode(resultBytes, version, ecLevel);\r
   }\r
 \r
   /**\r
@@ -120,7 +119,7 @@ public final class Decoder {
     try {\r
       rsDecoder.decode(codewordsInts, numECCodewords);\r
     } catch (ReedSolomonException rse) {\r
-      throw new ReaderException(rse.toString());\r
+      throw ReaderException.getInstance();\r
     }\r
     // Copy back into array of bytes -- only need to worry about the bytes that were data\r
     // We don't care about errors in the error-correction codewords\r