diff --git a/c/qrcodegen.c b/c/qrcodegen.c index b670ea1..386fd1e 100644 --- a/c/qrcodegen.c +++ b/c/qrcodegen.c @@ -341,9 +341,8 @@ testable void initializeFunctionModules(int version, uint8_t qrcode[]) { int numAlign = getAlignmentPatternPositions(version, alignPatPos); 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 + // Don't draw on the three finder corners + if (!((i == 0 && j == 0) || (i == 0 && j == numAlign - 1) || (i == numAlign - 1 && j == 0))) fillRectangle(alignPatPos[i] - 2, alignPatPos[j] - 2, 5, 5, qrcode); } } diff --git a/cpp/QrCode.cpp b/cpp/QrCode.cpp index 58c234a..6ddb0c7 100644 --- a/cpp/QrCode.cpp +++ b/cpp/QrCode.cpp @@ -203,9 +203,8 @@ void QrCode::drawFunctionPatterns() { int numAlign = alignPatPos.size(); 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 + // Don't draw on the three finder corners + if (!((i == 0 && j == 0) || (i == 0 && j == numAlign - 1) || (i == numAlign - 1 && j == 0))) drawAlignmentPattern(alignPatPos.at(i), alignPatPos.at(j)); } } diff --git a/java/io/nayuki/qrcodegen/QrCode.java b/java/io/nayuki/qrcodegen/QrCode.java index fbe16b7..d46bdd3 100644 --- a/java/io/nayuki/qrcodegen/QrCode.java +++ b/java/io/nayuki/qrcodegen/QrCode.java @@ -335,9 +335,8 @@ public final class QrCode { int numAlign = alignPatPos.length; 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 + // Don't draw on the three finder corners + if (!(i == 0 && j == 0 || i == 0 && j == numAlign - 1 || i == numAlign - 1 && j == 0)) drawAlignmentPattern(alignPatPos[i], alignPatPos[j]); } } diff --git a/javascript/qrcodegen.js b/javascript/qrcodegen.js index 3bf9f40..8da8e89 100644 --- a/javascript/qrcodegen.js +++ b/javascript/qrcodegen.js @@ -206,9 +206,8 @@ var qrcodegen = new function() { var numAlign = alignPatPos.length; for (var i = 0; i < numAlign; i++) { for (var 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 + // Don't draw on the three finder corners + if (!(i == 0 && j == 0 || i == 0 && j == numAlign - 1 || i == numAlign - 1 && j == 0)) drawAlignmentPattern(alignPatPos[i], alignPatPos[j]); } } diff --git a/python/qrcodegen.py b/python/qrcodegen.py index 58b8ab3..3399821 100644 --- a/python/qrcodegen.py +++ b/python/qrcodegen.py @@ -255,10 +255,10 @@ class QrCode(object): # Draw numerous alignment patterns alignpatpos = QrCode._get_alignment_pattern_positions(self._version) numalign = len(alignpatpos) - skips = ((0, 0), (0, numalign - 1), (numalign - 1, 0)) # Skip the three finder corners + skips = ((0, 0), (0, numalign - 1), (numalign - 1, 0)) for i in range(numalign): for j in range(numalign): - if (i, j) not in skips: + if (i, j) not in skips: # Don't draw on the three finder corners self._draw_alignment_pattern(alignpatpos[i], alignpatpos[j]) # Draw configuration data diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 149fbb8..589c01b 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -288,9 +288,8 @@ impl QrCode { let numalign: usize = alignpatpos.len(); for i in 0 .. numalign { for j in 0 .. numalign { - if i == 0 && j == 0 || i == 0 && j == numalign - 1 || i == numalign - 1 && j == 0 { - continue; // Skip the three finder corners - } else { + // Don't draw on the three finder corners + if !(i == 0 && j == 0 || i == 0 && j == numalign - 1 || i == numalign - 1 && j == 0) { self.draw_alignment_pattern(alignpatpos[i], alignpatpos[j]); } } diff --git a/typescript/qrcodegen.ts b/typescript/qrcodegen.ts index f82adc6..0c19436 100644 --- a/typescript/qrcodegen.ts +++ b/typescript/qrcodegen.ts @@ -269,9 +269,8 @@ namespace qrcodegen { let numAlign: int = alignPatPos.length; for (let i = 0; i < numAlign; i++) { for (let 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 + // Don't draw on the three finder corners + if (!(i == 0 && j == 0 || i == 0 && j == numAlign - 1 || i == numAlign - 1 && j == 0)) this.drawAlignmentPattern(alignPatPos[i], alignPatPos[j]); } }