X-Git-Url: http://git.rot13.org/?p=zxing.git;a=blobdiff_plain;f=core%2Fsrc%2Fcom%2Fgoogle%2Fzxing%2Fqrcode%2Fdecoder%2FBitMatrixParser.java;h=2a820ec8418560ca24b94fecfc7ec060944e0492;hp=c6f79b3dde5c583d0f7a9a61d89b5132e385be72;hb=feb768bba4b752ffe9ae48f6460675280517ec16;hpb=dfd8c1e623514366161858e9fc22c9a85009a298 diff --git a/core/src/com/google/zxing/qrcode/decoder/BitMatrixParser.java b/core/src/com/google/zxing/qrcode/decoder/BitMatrixParser.java index c6f79b3d..2a820ec8 100644 --- a/core/src/com/google/zxing/qrcode/decoder/BitMatrixParser.java +++ b/core/src/com/google/zxing/qrcode/decoder/BitMatrixParser.java @@ -54,36 +54,31 @@ final class BitMatrixParser { } // Read top-left format info bits - int formatInfoBits = 0; + int formatInfoBits1 = 0; for (int i = 0; i < 6; i++) { - formatInfoBits = copyBit(i, 8, formatInfoBits); + formatInfoBits1 = copyBit(i, 8, formatInfoBits1); } // .. and skip a bit in the timing pattern ... - formatInfoBits = copyBit(7, 8, formatInfoBits); - formatInfoBits = copyBit(8, 8, formatInfoBits); - formatInfoBits = copyBit(8, 7, formatInfoBits); + formatInfoBits1 = copyBit(7, 8, formatInfoBits1); + formatInfoBits1 = copyBit(8, 8, formatInfoBits1); + formatInfoBits1 = copyBit(8, 7, formatInfoBits1); // .. and skip a bit in the timing pattern ... for (int j = 5; j >= 0; j--) { - formatInfoBits = copyBit(8, j, formatInfoBits); + formatInfoBits1 = copyBit(8, j, formatInfoBits1); } - parsedFormatInfo = FormatInformation.decodeFormatInformation(formatInfoBits); - if (parsedFormatInfo != null) { - return parsedFormatInfo; - } - - // Hmm, failed. Try the top-right/bottom-left pattern + // Read the top-right/bottom-left pattern too int dimension = bitMatrix.getDimension(); - formatInfoBits = 0; + int formatInfoBits2 = 0; int iMin = dimension - 8; for (int i = dimension - 1; i >= iMin; i--) { - formatInfoBits = copyBit(i, 8, formatInfoBits); + formatInfoBits2 = copyBit(i, 8, formatInfoBits2); } for (int j = dimension - 7; j < dimension; j++) { - formatInfoBits = copyBit(8, j, formatInfoBits); + formatInfoBits2 = copyBit(8, j, formatInfoBits2); } - parsedFormatInfo = FormatInformation.decodeFormatInformation(formatInfoBits); + parsedFormatInfo = FormatInformation.decodeFormatInformation(formatInfoBits1, formatInfoBits2); if (parsedFormatInfo != null) { return parsedFormatInfo; }