Inverted some if-else statements in QrCode.getPenaltyScore() without changing behavior, in all languages.

This commit is contained in:
Project Nayuki
2018-10-26 05:24:21 +00:00
parent 111b20b2b9
commit 5ac0e2a938
7 changed files with 56 additions and 56 deletions
+8 -8
View File
@@ -433,15 +433,15 @@ long QrCode::getPenaltyScore() const {
bool color = false;
int runX = 0;
for (int x = 0; x < size; x++) {
if (module(x, y) != color) {
color = module(x, y);
runX = 1;
} else {
if (module(x, y) == color) {
runX++;
if (runX == 5)
result += PENALTY_N1;
else if (runX > 5)
result++;
} else {
color = module(x, y);
runX = 1;
}
}
}
@@ -450,15 +450,15 @@ long QrCode::getPenaltyScore() const {
bool color = false;
int runY = 0;
for (int y = 0; y < size; y++) {
if (module(x, y) != color) {
color = module(x, y);
runY = 1;
} else {
if (module(x, y) == color) {
runY++;
if (runY == 5)
result += PENALTY_N1;
else if (runY > 5)
result++;
} else {
color = module(x, y);
runY = 1;
}
}
}