|
|
@ -458,8 +458,8 @@ public final class QrCode {
|
|
|
|
if (mask == -1) { // Automatically choose best mask
|
|
|
|
if (mask == -1) { // Automatically choose best mask
|
|
|
|
int minPenalty = Integer.MAX_VALUE;
|
|
|
|
int minPenalty = Integer.MAX_VALUE;
|
|
|
|
for (int i = 0; i < 8; i++) {
|
|
|
|
for (int i = 0; i < 8; i++) {
|
|
|
|
drawFormatBits(i);
|
|
|
|
|
|
|
|
applyMask(masks[i]);
|
|
|
|
applyMask(masks[i]);
|
|
|
|
|
|
|
|
drawFormatBits(i);
|
|
|
|
int penalty = getPenaltyScore();
|
|
|
|
int penalty = getPenaltyScore();
|
|
|
|
if (penalty < minPenalty) {
|
|
|
|
if (penalty < minPenalty) {
|
|
|
|
mask = i;
|
|
|
|
mask = i;
|
|
|
@ -469,8 +469,8 @@ public final class QrCode {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
assert 0 <= mask && mask <= 7;
|
|
|
|
assert 0 <= mask && mask <= 7;
|
|
|
|
drawFormatBits(mask); // Overwrite old format bits
|
|
|
|
|
|
|
|
applyMask(masks[mask]); // Apply the final choice of mask
|
|
|
|
applyMask(masks[mask]); // Apply the final choice of mask
|
|
|
|
|
|
|
|
drawFormatBits(mask); // Overwrite old format bits
|
|
|
|
return mask; // The caller shall assign this value to the final-declared field
|
|
|
|
return mask; // The caller shall assign this value to the final-declared field
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|