Reordered calls to applyMask()/drawFormatBits() for conceptual clarity, without changing output (because masks don't affect format bits), in all language versions.

This commit is contained in:
Project Nayuki
2018-11-04 19:26:33 +00:00
parent 22319bf90f
commit fd083f70e8
7 changed files with 14 additions and 14 deletions
+2 -2
View File
@@ -148,8 +148,8 @@ QrCode::QrCode(int ver, Ecc ecl, const vector<uint8_t> &dataCodewords, int mask)
if (mask == -1) { // Automatically choose best mask
long minPenalty = LONG_MAX;
for (int i = 0; i < 8; i++) {
drawFormatBits(i);
applyMask(i);
drawFormatBits(i);
long penalty = getPenaltyScore();
if (penalty < minPenalty) {
mask = i;
@@ -161,8 +161,8 @@ QrCode::QrCode(int ver, Ecc ecl, const vector<uint8_t> &dataCodewords, int mask)
if (mask < 0 || mask > 7)
throw std::logic_error("Assertion error");
this->mask = mask;
drawFormatBits(mask); // Overwrite old format bits
applyMask(mask); // Apply the final choice of mask
drawFormatBits(mask); // Overwrite old format bits
isFunction.clear();
isFunction.shrink_to_fit();