Converted the last user of the old MonochromeBitmapSource-style calls over to BitMatr...
[zxing.git] / core / src / com / google / zxing / pdf417 / PDF417Reader.java
index eee1bd4..1510f92 100644 (file)
@@ -77,14 +77,14 @@ public final class PDF417Reader implements Reader {
    */\r
   private static BitMatrix extractPureBits(BinaryBitmap image) throws ReaderException {\r
     // Now need to determine module size in pixels\r
-\r
-    int height = image.getHeight();\r
-    int width = image.getWidth();\r
+    BitMatrix matrix = image.getBlackMatrix();\r
+    int height = matrix.getHeight();\r
+    int width = matrix.getWidth();\r
     int minDimension = Math.min(height, width);\r
 \r
     // First, skip white border by tracking diagonally from the top left down and to the right:\r
     int borderWidth = 0;\r
-    while (borderWidth < minDimension && !image.isBlack(borderWidth, borderWidth)) {\r
+    while (borderWidth < minDimension && !matrix.get(borderWidth, borderWidth)) {\r
       borderWidth++;\r
     }\r
     if (borderWidth == minDimension) {\r
@@ -93,7 +93,7 @@ public final class PDF417Reader implements Reader {
 \r
     // And then keep tracking across the top-left black module to determine module size\r
     int moduleEnd = borderWidth;\r
-    while (moduleEnd < minDimension && image.isBlack(moduleEnd, moduleEnd)) {\r
+    while (moduleEnd < minDimension && matrix.get(moduleEnd, moduleEnd)) {\r
       moduleEnd++;\r
     }\r
     if (moduleEnd == minDimension) {\r
@@ -104,7 +104,7 @@ public final class PDF417Reader implements Reader {
 \r
     // And now find where the rightmost black module on the first row ends\r
     int rowEndOfSymbol = width - 1;\r
-    while (rowEndOfSymbol >= 0 && !image.isBlack(rowEndOfSymbol, borderWidth)) {\r
+    while (rowEndOfSymbol >= 0 && !matrix.get(rowEndOfSymbol, borderWidth)) {\r
       rowEndOfSymbol--;\r
     }\r
     if (rowEndOfSymbol < 0) {\r
@@ -130,15 +130,14 @@ public final class PDF417Reader implements Reader {
 \r
     // Now just read off the bits\r
     BitMatrix bits = new BitMatrix(dimension);\r
-    for (int i = 0; i < dimension; i++) {\r
-      int iOffset = borderWidth + i * moduleSize;\r
-      for (int j = 0; j < dimension; j++) {\r
-        if (image.isBlack(borderWidth + j * moduleSize, iOffset)) {\r
-          bits.set(i, j);\r
+    for (int y = 0; y < dimension; y++) {\r
+      int iOffset = borderWidth + y * moduleSize;\r
+      for (int x = 0; x < dimension; x++) {\r
+        if (matrix.get(borderWidth + x * moduleSize, iOffset)) {\r
+          bits.set(x, y);\r
         }\r
       }\r
     }\r
     return bits;\r
   }\r
 }\r
-\r