Simplified small pieces of logic.

pull/134/head
Project Nayuki 6 years ago
parent 3e6381cea8
commit eb072ba84e

@ -125,9 +125,7 @@ final class QrTemplate {
int numAlign = alignPatPos.length; int numAlign = alignPatPos.length;
for (int i = 0; i < numAlign; i++) { for (int i = 0; i < numAlign; i++) {
for (int j = 0; j < numAlign; j++) { for (int j = 0; j < numAlign; j++) {
if (i == 0 && j == 0 || i == 0 && j == numAlign - 1 || i == numAlign - 1 && j == 0) if (!(i == 0 && j == 0 || i == 0 && j == numAlign - 1 || i == numAlign - 1 && j == 0))
continue; // Skip the three finder corners
else
drawAlignmentPattern(alignPatPos[i], alignPatPos[j]); drawAlignmentPattern(alignPatPos[i], alignPatPos[j]);
} }
} }
@ -201,7 +199,7 @@ final class QrTemplate {
private void drawAlignmentPattern(int x, int y) { private void drawAlignmentPattern(int x, int y) {
for (int dy = -2; dy <= 2; dy++) { for (int dy = -2; dy <= 2; dy++) {
for (int dx = -2; dx <= 2; dx++) for (int dx = -2; dx <= 2; dx++)
darkenFunctionModule(x + dx, y + dy, (Math.max(Math.abs(dx), Math.abs(dy)) != 1) ? 1 : 0); darkenFunctionModule(x + dx, y + dy, Math.abs(Math.max(Math.abs(dx), Math.abs(dy)) - 1));
} }
} }

Loading…
Cancel
Save