mirror of
https://github.com/zxing/zxing.git
synced 2025-02-02 05:41:08 -08:00
Fix some double-reversed i-j problems in this code
git-svn-id: https://zxing.googlecode.com/svn/trunk@1104 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
3b957d3dec
commit
8e4824da68
|
@ -55,16 +55,16 @@ final class BitMatrixParser {
|
||||||
|
|
||||||
// Read top-left format info bits
|
// Read top-left format info bits
|
||||||
int formatInfoBits = 0;
|
int formatInfoBits = 0;
|
||||||
for (int j = 0; j < 6; j++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
formatInfoBits = copyBit(8, j, formatInfoBits);
|
formatInfoBits = copyBit(i, 8, formatInfoBits);
|
||||||
}
|
}
|
||||||
// .. and skip a bit in the timing pattern ...
|
// .. and skip a bit in the timing pattern ...
|
||||||
formatInfoBits = copyBit(8, 7, formatInfoBits);
|
|
||||||
formatInfoBits = copyBit(8, 8, formatInfoBits);
|
|
||||||
formatInfoBits = copyBit(7, 8, formatInfoBits);
|
formatInfoBits = copyBit(7, 8, formatInfoBits);
|
||||||
|
formatInfoBits = copyBit(8, 8, formatInfoBits);
|
||||||
|
formatInfoBits = copyBit(8, 7, formatInfoBits);
|
||||||
// .. and skip a bit in the timing pattern ...
|
// .. and skip a bit in the timing pattern ...
|
||||||
for (int i = 5; i >= 0; i--) {
|
for (int j = 5; j >= 0; j--) {
|
||||||
formatInfoBits = copyBit(i, 8, formatInfoBits);
|
formatInfoBits = copyBit(8, j, formatInfoBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
parsedFormatInfo = FormatInformation.decodeFormatInformation(formatInfoBits);
|
parsedFormatInfo = FormatInformation.decodeFormatInformation(formatInfoBits);
|
||||||
|
@ -112,9 +112,9 @@ final class BitMatrixParser {
|
||||||
|
|
||||||
// Read top-right version info: 3 wide by 6 tall
|
// Read top-right version info: 3 wide by 6 tall
|
||||||
int versionBits = 0;
|
int versionBits = 0;
|
||||||
for (int i = 5; i >= 0; i--) {
|
int ijMin = dimension - 11;
|
||||||
int jMin = dimension - 11;
|
for (int j = 5; j >= 0; j--) {
|
||||||
for (int j = dimension - 9; j >= jMin; j--) {
|
for (int i = dimension - 9; i >= ijMin; i--) {
|
||||||
versionBits = copyBit(i, j, versionBits);
|
versionBits = copyBit(i, j, versionBits);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,9 +126,8 @@ final class BitMatrixParser {
|
||||||
|
|
||||||
// Hmm, failed. Try bottom left: 6 wide by 3 tall
|
// Hmm, failed. Try bottom left: 6 wide by 3 tall
|
||||||
versionBits = 0;
|
versionBits = 0;
|
||||||
for (int j = 5; j >= 0; j--) {
|
for (int i = 5; i >= 0; i--) {
|
||||||
int iMin = dimension - 11;
|
for (int j = dimension - 9; j >= ijMin; j--) {
|
||||||
for (int i = dimension - 9; i >= iMin; i--) {
|
|
||||||
versionBits = copyBit(i, j, versionBits);
|
versionBits = copyBit(i, j, versionBits);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,7 +140,7 @@ final class BitMatrixParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
private int copyBit(int i, int j, int versionBits) {
|
private int copyBit(int i, int j, int versionBits) {
|
||||||
return bitMatrix.get(j, i) ? (versionBits << 1) | 0x1 : versionBits << 1;
|
return bitMatrix.get(i, j) ? (versionBits << 1) | 0x1 : versionBits << 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue