Simplified some code.
This commit is contained in:
parent
669585590b
commit
0bf2d3306b
|
@ -202,7 +202,7 @@ testable void addEccAndInterleave(uint8_t data[], int version, enum qrcodegen_Ec
|
||||||
int numBlocks = NUM_ERROR_CORRECTION_BLOCKS[(int)ecl][version];
|
int numBlocks = NUM_ERROR_CORRECTION_BLOCKS[(int)ecl][version];
|
||||||
int blockEccLen = ECC_CODEWORDS_PER_BLOCK[(int)ecl][version];
|
int blockEccLen = ECC_CODEWORDS_PER_BLOCK[(int)ecl][version];
|
||||||
int rawCodewords = getNumRawDataModules(version) / 8;
|
int rawCodewords = getNumRawDataModules(version) / 8;
|
||||||
int dataLen = rawCodewords - blockEccLen * numBlocks;
|
int dataLen = getNumDataCodewords(version, ecl);
|
||||||
int numShortBlocks = numBlocks - rawCodewords % numBlocks;
|
int numShortBlocks = numBlocks - rawCodewords % numBlocks;
|
||||||
int shortBlockDataLen = rawCodewords / numBlocks - blockEccLen;
|
int shortBlockDataLen = rawCodewords / numBlocks - blockEccLen;
|
||||||
|
|
||||||
|
@ -384,12 +384,10 @@ static void drawWhiteFunctionModules(uint8_t qrcode[], int version) {
|
||||||
for (int i = 0; i < numAlign; i++) {
|
for (int i = 0; i < numAlign; i++) {
|
||||||
for (int j = 0; j < numAlign; j++) {
|
for (int j = 0; j < numAlign; j++) {
|
||||||
if ((i == 0 && j == 0) || (i == 0 && j == numAlign - 1) || (i == numAlign - 1 && j == 0))
|
if ((i == 0 && j == 0) || (i == 0 && j == numAlign - 1) || (i == numAlign - 1 && j == 0))
|
||||||
continue; // Skip the three finder corners
|
continue; // Don't draw on the three finder corners
|
||||||
else {
|
for (int k = -1; k <= 1; k++) {
|
||||||
for (int k = -1; k <= 1; k++) {
|
for (int l = -1; l <= 1; l++)
|
||||||
for (int l = -1; l <= 1; l++)
|
setModule(qrcode, alignPatPos[i] + l, alignPatPos[j] + k, k == 0 && l == 0);
|
||||||
setModule(qrcode, alignPatPos[i] + l, alignPatPos[j] + k, k == 0 && l == 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -688,7 +688,7 @@ public final class QrCode {
|
||||||
result -= (numAlign - 2) * 2 * 20; // Subtract alignment patterns that overlap with timing patterns
|
result -= (numAlign - 2) * 2 * 20; // Subtract alignment patterns that overlap with timing patterns
|
||||||
// The two lines above are equivalent to: result -= (25 * numAlign - 10) * numAlign - 55;
|
// The two lines above are equivalent to: result -= (25 * numAlign - 10) * numAlign - 55;
|
||||||
if (ver >= 7)
|
if (ver >= 7)
|
||||||
result -= 18 * 2; // Subtract version information
|
result -= 6 * 3 * 2; // Subtract version information
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue