Tweaked two comments in QrCode constructor, in all languages except C.

pull/39/merge
Project Nayuki 6 years ago
parent f63f7f79a6
commit d060e97e03

@ -119,14 +119,14 @@ QrCode::QrCode(int ver, Ecc ecl, const vector<uint8_t> &dataCodewords, int mask)
version(ver),
size(MIN_VERSION <= ver && ver <= MAX_VERSION ? ver * 4 + 17 : -1), // Avoid signed overflow undefined behavior
errorCorrectionLevel(ecl),
modules (size, vector<bool>(size)), // Entirely white grid
modules (size, vector<bool>(size)), // Initially all white
isFunction(size, vector<bool>(size)) {
// Check arguments
if (ver < MIN_VERSION || ver > MAX_VERSION || mask < -1 || mask > 7)
throw std::domain_error("Value out of range");
// Draw function patterns, draw all codewords, do masking
// Compute ECC, draw modules, do masking
drawFunctionPatterns();
const vector<uint8_t> allCodewords = addEccAndInterleave(dataCodewords);
drawCodewords(allCodewords);

@ -222,10 +222,10 @@ public final class QrCode {
// Initialize fields
version = ver;
size = ver * 4 + 17;
modules = new boolean[size][size]; // Entirely white grid
modules = new boolean[size][size]; // Initially all white
isFunction = new boolean[size][size];
// Draw function patterns, draw all codewords, do masking
// Compute ECC, draw modules, do masking
drawFunctionPatterns();
byte[] allCodewords = addEccAndInterleave(dataCodewords);
drawCodewords(allCodewords);

@ -83,14 +83,14 @@ var qrcodegen = new function() {
var row = [];
for (var i = 0; i < size; i++)
row.push(false);
var modules = [];
var modules = []; // Initially all white
var isFunction = [];
for (var i = 0; i < size; i++) {
modules .push(row.slice());
isFunction.push(row.slice());
}
// Handle grid fields, draw function patterns, draw all codewords
// Compute ECC, draw modules
drawFunctionPatterns();
var allCodewords = addEccAndInterleave(dataCodewords);
drawCodewords(allCodewords);

@ -167,11 +167,11 @@ class QrCode(object):
# Initialize grids of modules
# The modules of this QR Code symbol (False = white, True = black). Immutable after constructor finishes
self._modules = [[False] * self._size for _ in range(self._size)]
self._modules = [[False] * self._size for _ in range(self._size)] # Initially all white
# Indicates function modules that are not subjected to masking. Discarded when constructor finishes
self._isfunction = [[False] * self._size for _ in range(self._size)]
# Draw function patterns, draw all codewords
# Compute ECC, draw modules
self._draw_function_patterns()
allcodewords = self._add_ecc_and_interleave(datacodewords)
self._draw_codewords(allcodewords)

@ -186,11 +186,11 @@ impl QrCode {
size: size as i32,
mask: Mask::new(0), // Dummy value
errorcorrectionlevel: ecl,
modules : vec![false; size * size], // Entirely white grid
modules : vec![false; size * size], // Initially all white
isfunction: vec![false; size * size],
};
// Draw function patterns, draw all codewords, do masking
// Compute ECC, draw modules, do masking
result.draw_function_patterns();
let allcodewords: Vec<u8> = result.add_ecc_and_interleave(datacodewords);
result.draw_codewords(&allcodewords);

@ -172,11 +172,11 @@ namespace qrcodegen {
for (let i = 0; i < this.size; i++)
row.push(false);
for (let i = 0; i < this.size; i++) {
this.modules .push(row.slice());
this.modules .push(row.slice()); // Initially all white
this.isFunction.push(row.slice());
}
// Handle grid fields, draw function patterns, draw all codewords
// Compute ECC, draw modules
this.drawFunctionPatterns();
let allCodewords: Array<byte> = this.addEccAndInterleave(dataCodewords);
this.drawCodewords(allCodewords);

Loading…
Cancel
Save