Simplified some code.

This commit is contained in:
Project Nayuki 2018-08-28 07:18:56 +00:00
parent 669585590b
commit 0bf2d3306b
2 changed files with 6 additions and 8 deletions

View File

@ -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 blockEccLen = ECC_CODEWORDS_PER_BLOCK[(int)ecl][version];
int rawCodewords = getNumRawDataModules(version) / 8;
int dataLen = rawCodewords - blockEccLen * numBlocks;
int dataLen = getNumDataCodewords(version, ecl);
int numShortBlocks = numBlocks - rawCodewords % numBlocks;
int shortBlockDataLen = rawCodewords / numBlocks - blockEccLen;
@ -384,15 +384,13 @@ static void drawWhiteFunctionModules(uint8_t qrcode[], int version) {
for (int i = 0; i < numAlign; i++) {
for (int j = 0; j < numAlign; j++) {
if ((i == 0 && j == 0) || (i == 0 && j == numAlign - 1) || (i == numAlign - 1 && j == 0))
continue; // Skip the three finder corners
else {
continue; // Don't draw on the three finder corners
for (int k = -1; k <= 1; k++) {
for (int l = -1; l <= 1; l++)
setModule(qrcode, alignPatPos[i] + l, alignPatPos[j] + k, k == 0 && l == 0);
}
}
}
}
// Draw version blocks
if (version >= 7) {

View File

@ -688,7 +688,7 @@ public final class QrCode {
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;
if (ver >= 7)
result -= 18 * 2; // Subtract version information
result -= 6 * 3 * 2; // Subtract version information
}
return result;
}