From 3e6381cea83f5c3a2c5f93beed59a3439981aba0 Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Sun, 7 Oct 2018 06:50:45 +0000 Subject: [PATCH] Renamed loop variables and swapped commutative arguments for clarity. --- src/io/nayuki/fastqrcodegen/QrTemplate.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/io/nayuki/fastqrcodegen/QrTemplate.java b/src/io/nayuki/fastqrcodegen/QrTemplate.java index 9ecbbbd..49aad5d 100644 --- a/src/io/nayuki/fastqrcodegen/QrTemplate.java +++ b/src/io/nayuki/fastqrcodegen/QrTemplate.java @@ -185,10 +185,10 @@ final class QrTemplate { // Draws a 9*9 finder pattern including the border separator, // with the center module at (x, y). Modules can be out of bounds. private void drawFinderPattern(int x, int y) { - for (int i = -4; i <= 4; i++) { - for (int j = -4; j <= 4; j++) { - int dist = Math.max(Math.abs(i), Math.abs(j)); // Chebyshev/infinity norm - int xx = x + j, yy = y + i; + for (int dy = -4; dy <= 4; dy++) { + for (int dx = -4; dx <= 4; dx++) { + int dist = Math.max(Math.abs(dx), Math.abs(dy)); // Chebyshev/infinity norm + int xx = x + dx, yy = y + dy; if (0 <= xx && xx < size && 0 <= yy && yy < size) darkenFunctionModule(xx, yy, (dist != 2 && dist != 4) ? 1 : 0); } @@ -199,9 +199,9 @@ final class QrTemplate { // Draws a 5*5 alignment pattern, with the center module // at (x, y). All modules must be in bounds. private void drawAlignmentPattern(int x, int y) { - for (int i = -2; i <= 2; i++) { - for (int j = -2; j <= 2; j++) - darkenFunctionModule(x + j, y + i, (Math.max(Math.abs(i), Math.abs(j)) != 1) ? 1 : 0); + for (int dy = -2; dy <= 2; dy++) { + for (int dx = -2; dx <= 2; dx++) + darkenFunctionModule(x + dx, y + dy, (Math.max(Math.abs(dx), Math.abs(dy)) != 1) ? 1 : 0); } }