MaskUtil.java (zxing-zxing-3.4.1) | : | MaskUtil.java (zxing-zxing-3.5.0) | ||
---|---|---|---|---|
skipping to change at line 107 | skipping to change at line 107 | |||
array[y + 6][x] == 1 && | array[y + 6][x] == 1 && | |||
(isWhiteVertical(array, x, y - 4, y) || isWhiteVertical(array, x, y + 7, y + 11))) { | (isWhiteVertical(array, x, y - 4, y) || isWhiteVertical(array, x, y + 7, y + 11))) { | |||
numPenalties++; | numPenalties++; | |||
} | } | |||
} | } | |||
} | } | |||
return numPenalties * N3; | return numPenalties * N3; | |||
} | } | |||
private static boolean isWhiteHorizontal(byte[] rowArray, int from, int to) { | private static boolean isWhiteHorizontal(byte[] rowArray, int from, int to) { | |||
from = Math.max(from, 0); | if (from < 0 || rowArray.length < to) { | |||
to = Math.min(to, rowArray.length); | return false; | |||
} | ||||
for (int i = from; i < to; i++) { | for (int i = from; i < to; i++) { | |||
if (rowArray[i] == 1) { | if (rowArray[i] == 1) { | |||
return false; | return false; | |||
} | } | |||
} | } | |||
return true; | return true; | |||
} | } | |||
private static boolean isWhiteVertical(byte[][] array, int col, int from, int to) { | private static boolean isWhiteVertical(byte[][] array, int col, int from, int to) { | |||
from = Math.max(from, 0); | if (from < 0 || array.length < to) { | |||
to = Math.min(to, array.length); | return false; | |||
} | ||||
for (int i = from; i < to; i++) { | for (int i = from; i < to; i++) { | |||
if (array[i][col] == 1) { | if (array[i][col] == 1) { | |||
return false; | return false; | |||
} | } | |||
} | } | |||
return true; | return true; | |||
} | } | |||
/** | /** | |||
* Apply mask penalty rule 4 and return the penalty. Calculate the ratio of da rk cells and give | * Apply mask penalty rule 4 and return the penalty. Calculate the ratio of da rk cells and give | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 6 lines changed or added |