Tweaked QrCode.drawFormatBits() to use end-exclusive range in second copy for clarity, in most languages.

pull/40/head
Project Nayuki 6 years ago
parent e883e31f0a
commit f2ea49b7d4

@ -528,7 +528,7 @@ static void drawFormatBits(enum qrcodegen_Ecc ecl, enum qrcodegen_Mask mask, uin
// Draw second copy // Draw second copy
int qrsize = qrcodegen_getSize(qrcode); int qrsize = qrcodegen_getSize(qrcode);
for (int i = 0; i <= 7; i++) for (int i = 0; i < 8; i++)
setModule(qrcode, qrsize - 1 - i, 8, getBit(bits, i)); setModule(qrcode, qrsize - 1 - i, 8, getBit(bits, i));
for (int i = 8; i < 15; i++) for (int i = 8; i < 15; i++)
setModule(qrcode, 8, qrsize - 15 + i, getBit(bits, i)); setModule(qrcode, 8, qrsize - 15 + i, getBit(bits, i));

@ -243,7 +243,7 @@ void QrCode::drawFormatBits(int mask) {
setFunctionModule(14 - i, 8, getBit(bits, i)); setFunctionModule(14 - i, 8, getBit(bits, i));
// Draw second copy // Draw second copy
for (int i = 0; i <= 7; i++) for (int i = 0; i < 8; i++)
setFunctionModule(size - 1 - i, 8, getBit(bits, i)); setFunctionModule(size - 1 - i, 8, getBit(bits, i));
for (int i = 8; i < 15; i++) for (int i = 8; i < 15; i++)
setFunctionModule(8, size - 15 + i, getBit(bits, i)); setFunctionModule(8, size - 15 + i, getBit(bits, i));

@ -396,7 +396,7 @@ public final class QrCode {
setFunctionModule(14 - i, 8, getBit(bits, i)); setFunctionModule(14 - i, 8, getBit(bits, i));
// Draw second copy // Draw second copy
for (int i = 0; i <= 7; i++) for (int i = 0; i < 8; i++)
setFunctionModule(size - 1 - i, 8, getBit(bits, i)); setFunctionModule(size - 1 - i, 8, getBit(bits, i));
for (int i = 8; i < 15; i++) for (int i = 8; i < 15; i++)
setFunctionModule(8, size - 15 + i, getBit(bits, i)); setFunctionModule(8, size - 15 + i, getBit(bits, i));

@ -257,7 +257,7 @@ var qrcodegen = new function() {
setFunctionModule(14 - i, 8, getBit(bits, i)); setFunctionModule(14 - i, 8, getBit(bits, i));
// Draw second copy // Draw second copy
for (var i = 0; i <= 7; i++) for (var i = 0; i < 8; i++)
setFunctionModule(size - 1 - i, 8, getBit(bits, i)); setFunctionModule(size - 1 - i, 8, getBit(bits, i));
for (var i = 8; i < 15; i++) for (var i = 8; i < 15; i++)
setFunctionModule(8, size - 15 + i, getBit(bits, i)); setFunctionModule(8, size - 15 + i, getBit(bits, i));

@ -337,7 +337,7 @@ namespace qrcodegen {
this.setFunctionModule(14 - i, 8, getBit(bits, i)); this.setFunctionModule(14 - i, 8, getBit(bits, i));
// Draw second copy // Draw second copy
for (let i = 0; i <= 7; i++) for (let i = 0; i < 8; i++)
this.setFunctionModule(this.size - 1 - i, 8, getBit(bits, i)); this.setFunctionModule(this.size - 1 - i, 8, getBit(bits, i));
for (let i = 8; i < 15; i++) for (let i = 8; i < 15; i++)
this.setFunctionModule(8, this.size - 15 + i, getBit(bits, i)); this.setFunctionModule(8, this.size - 15 + i, getBit(bits, i));

Loading…
Cancel
Save