Clarified code in QrCode.drawVersion() in 4 language versions.

pull/39/merge
Project Nayuki 6 years ago
parent 62e73f787a
commit 6f45d3b573

@ -259,7 +259,8 @@ void QrCode::drawVersion() {
// Draw two copies // Draw two copies
for (int i = 0; i < 18; i++) { for (int i = 0; i < 18; i++) {
bool bit = getBit(bits, i); bool bit = getBit(bits, i);
int a = size - 11 + i % 3, b = i / 3; int a = size - 11 + i % 3;
int b = i / 3;
setFunctionModule(a, b, bit); setFunctionModule(a, b, bit);
setFunctionModule(b, a, bit); setFunctionModule(b, a, bit);
} }

@ -388,7 +388,8 @@ public final class QrCode {
// Draw two copies // Draw two copies
for (int i = 0; i < 18; i++) { for (int i = 0; i < 18; i++) {
boolean bit = getBit(bits, i); boolean bit = getBit(bits, i);
int a = size - 11 + i % 3, b = i / 3; int a = size - 11 + i % 3;
int b = i / 3;
setFunctionModule(a, b, bit); setFunctionModule(a, b, bit);
setFunctionModule(b, a, bit); setFunctionModule(b, a, bit);
} }

@ -266,7 +266,8 @@ var qrcodegen = new function() {
// Draw two copies // Draw two copies
for (var i = 0; i < 18; i++) { for (var i = 0; i < 18; i++) {
var bit = getBit(bits, i); var bit = getBit(bits, i);
var a = size - 11 + i % 3, b = Math.floor(i / 3); var a = size - 11 + i % 3;
var b = Math.floor(i / 3);
setFunctionModule(a, b, bit); setFunctionModule(a, b, bit);
setFunctionModule(b, a, bit); setFunctionModule(b, a, bit);
} }

@ -310,7 +310,8 @@ class QrCode(object):
# Draw two copies # Draw two copies
for i in range(18): for i in range(18):
bit = _get_bit(bits, i) bit = _get_bit(bits, i)
a, b = self._size - 11 + i % 3, i // 3 a = self._size - 11 + i % 3
b = i // 3
self._set_function_module(a, b, bit) self._set_function_module(a, b, bit)
self._set_function_module(b, a, bit) self._set_function_module(b, a, bit)

Loading…
Cancel
Save