MaxiCodeReader.java (zxing-zxing-3.4.1) | : | MaxiCodeReader.java (zxing-zxing-3.5.0) | ||
---|---|---|---|---|
skipping to change at line 101 | skipping to change at line 101 | |||
} | } | |||
int left = enclosingRectangle[0]; | int left = enclosingRectangle[0]; | |||
int top = enclosingRectangle[1]; | int top = enclosingRectangle[1]; | |||
int width = enclosingRectangle[2]; | int width = enclosingRectangle[2]; | |||
int height = enclosingRectangle[3]; | int height = enclosingRectangle[3]; | |||
// Now just read off the bits | // Now just read off the bits | |||
BitMatrix bits = new BitMatrix(MATRIX_WIDTH, MATRIX_HEIGHT); | BitMatrix bits = new BitMatrix(MATRIX_WIDTH, MATRIX_HEIGHT); | |||
for (int y = 0; y < MATRIX_HEIGHT; y++) { | for (int y = 0; y < MATRIX_HEIGHT; y++) { | |||
int iy = top + (y * height + height / 2) / MATRIX_HEIGHT; | int iy = Math.min(top + (y * height + height / 2) / MATRIX_HEIGHT, height - 1); | |||
for (int x = 0; x < MATRIX_WIDTH; x++) { | for (int x = 0; x < MATRIX_WIDTH; x++) { | |||
int ix = left + (x * width + width / 2 + (y & 0x01) * width / 2) / MATR | // srowen: I don't quite understand why the formula below is necessary, | |||
IX_WIDTH; | but it | |||
// can walk off the image if left + width = the right boundary. So cap i | ||||
t. | ||||
int ix = left + Math.min( | ||||
(x * width + width / 2 + (y & 0x01) * width / 2) / MATRIX_WIDTH, | ||||
width - 1); | ||||
if (image.get(ix, iy)) { | if (image.get(ix, iy)) { | |||
bits.set(x, y); | bits.set(x, y); | |||
} | } | |||
} | } | |||
} | } | |||
return bits; | return bits; | |||
} | } | |||
} | } | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 8 lines changed or added |