mirror of
https://github.com/status-im/QR-Code-generator.git
synced 2026-08-31 01:31:10 +00:00
Tweaked logic in QrCode.getPenaltyScore() for future expansion, without changing behavior, in all languages.
This commit is contained in:
+6
-4
@@ -431,8 +431,9 @@ long QrCode::getPenaltyScore() const {
|
||||
// Adjacent modules in row having same color
|
||||
for (int y = 0; y < size; y++) {
|
||||
bool color = false;
|
||||
for (int x = 0, runX = -1; x < size; x++) {
|
||||
if (x == 0 || module(x, y) != color) {
|
||||
int runX = 0;
|
||||
for (int x = 0; x < size; x++) {
|
||||
if (module(x, y) != color) {
|
||||
color = module(x, y);
|
||||
runX = 1;
|
||||
} else {
|
||||
@@ -447,8 +448,9 @@ long QrCode::getPenaltyScore() const {
|
||||
// Adjacent modules in column having same color
|
||||
for (int x = 0; x < size; x++) {
|
||||
bool color = false;
|
||||
for (int y = 0, runY = -1; y < size; y++) {
|
||||
if (y == 0 || module(x, y) != color) {
|
||||
int runY = 0;
|
||||
for (int y = 0; y < size; y++) {
|
||||
if (module(x, y) != color) {
|
||||
color = module(x, y);
|
||||
runY = 1;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user