Aligned code involving QrCode grid fields, in most languages.
This commit is contained in:
parent
fd64af3e50
commit
0a0ac19f9b
|
@ -119,7 +119,7 @@ QrCode::QrCode(int ver, Ecc ecl, const vector<uint8_t> &dataCodewords, int mask)
|
||||||
version(ver),
|
version(ver),
|
||||||
size(MIN_VERSION <= ver && ver <= MAX_VERSION ? ver * 4 + 17 : -1), // Avoid signed overflow undefined behavior
|
size(MIN_VERSION <= ver && ver <= MAX_VERSION ? ver * 4 + 17 : -1), // Avoid signed overflow undefined behavior
|
||||||
errorCorrectionLevel(ecl),
|
errorCorrectionLevel(ecl),
|
||||||
modules(size, vector<bool>(size)), // Entirely white grid
|
modules (size, vector<bool>(size)), // Entirely white grid
|
||||||
isFunction(size, vector<bool>(size)) {
|
isFunction(size, vector<bool>(size)) {
|
||||||
|
|
||||||
// Check arguments
|
// Check arguments
|
||||||
|
|
|
@ -86,7 +86,7 @@ var qrcodegen = new function() {
|
||||||
var modules = [];
|
var modules = [];
|
||||||
var isFunction = [];
|
var isFunction = [];
|
||||||
for (var i = 0; i < size; i++) {
|
for (var i = 0; i < size; i++) {
|
||||||
modules.push(row.slice());
|
modules .push(row.slice());
|
||||||
isFunction.push(row.slice());
|
isFunction.push(row.slice());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -186,7 +186,7 @@ impl QrCode {
|
||||||
size: size as i32,
|
size: size as i32,
|
||||||
mask: Mask::new(0), // Dummy value
|
mask: Mask::new(0), // Dummy value
|
||||||
errorcorrectionlevel: ecl,
|
errorcorrectionlevel: ecl,
|
||||||
modules: vec![false; size * size], // Entirely white grid
|
modules : vec![false; size * size], // Entirely white grid
|
||||||
isfunction: vec![false; size * size],
|
isfunction: vec![false; size * size],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ namespace qrcodegen {
|
||||||
public readonly size: int;
|
public readonly size: int;
|
||||||
|
|
||||||
// The modules of this QR Code symbol (false = white, true = black). Immutable after constructor finishes.
|
// The modules of this QR Code symbol (false = white, true = black). Immutable after constructor finishes.
|
||||||
private readonly modules: Array<Array<boolean>> = [];
|
private readonly modules : Array<Array<boolean>> = [];
|
||||||
|
|
||||||
// Indicates function modules that are not subjected to masking. Discarded when constructor finishes.
|
// Indicates function modules that are not subjected to masking. Discarded when constructor finishes.
|
||||||
private readonly isFunction: Array<Array<boolean>> = [];
|
private readonly isFunction: Array<Array<boolean>> = [];
|
||||||
|
@ -172,7 +172,7 @@ namespace qrcodegen {
|
||||||
for (let i = 0; i < this.size; i++)
|
for (let i = 0; i < this.size; i++)
|
||||||
row.push(false);
|
row.push(false);
|
||||||
for (let i = 0; i < this.size; i++) {
|
for (let i = 0; i < this.size; i++) {
|
||||||
this.modules.push(row.slice());
|
this.modules .push(row.slice());
|
||||||
this.isFunction.push(row.slice());
|
this.isFunction.push(row.slice());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue