mirror of
https://github.com/zxing/zxing.git
synced 2024-11-10 04:54:04 -08:00
Fix two other AIOOBE from pure barcode mode, update javadoc
git-svn-id: https://zxing.googlecode.com/svn/trunk@2696 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
99e41ef79d
commit
c2ddf95c8a
|
@ -97,7 +97,6 @@ public final class DataMatrixReader implements Reader {
|
|||
* around it. This is a specialized method that works exceptionally fast in this special
|
||||
* case.
|
||||
*
|
||||
* @see com.google.zxing.pdf417.PDF417Reader#extractPureBits(BitMatrix)
|
||||
* @see com.google.zxing.qrcode.QRCodeReader#extractPureBits(BitMatrix)
|
||||
*/
|
||||
private static BitMatrix extractPureBits(BitMatrix image) throws NotFoundException {
|
||||
|
|
|
@ -92,7 +92,6 @@ public final class MaxiCodeReader implements Reader {
|
|||
* around it. This is a specialized method that works exceptionally fast in this special
|
||||
* case.
|
||||
*
|
||||
* @see com.google.zxing.pdf417.PDF417Reader#extractPureBits(BitMatrix)
|
||||
* @see com.google.zxing.datamatrix.DataMatrixReader#extractPureBits(BitMatrix)
|
||||
* @see com.google.zxing.qrcode.QRCodeReader#extractPureBits(BitMatrix)
|
||||
*/
|
||||
|
|
|
@ -101,7 +101,6 @@ public class QRCodeReader implements Reader {
|
|||
* around it. This is a specialized method that works exceptionally fast in this special
|
||||
* case.
|
||||
*
|
||||
* @see com.google.zxing.pdf417.PDF417Reader#extractPureBits(BitMatrix)
|
||||
* @see com.google.zxing.datamatrix.DataMatrixReader#extractPureBits(BitMatrix)
|
||||
*/
|
||||
private static BitMatrix extractPureBits(BitMatrix image) throws NotFoundException {
|
||||
|
@ -146,6 +145,16 @@ public class QRCodeReader implements Reader {
|
|||
int nudge = (int) (moduleSize / 2.0f);
|
||||
top += nudge;
|
||||
left += nudge;
|
||||
|
||||
// But careful that this does not sample off the edge
|
||||
int nudgedTooFarRight = left + (int) ((matrixWidth - 1) * moduleSize) - (right - 1);
|
||||
if (nudgedTooFarRight > 0) {
|
||||
left -= nudgedTooFarRight;
|
||||
}
|
||||
int nudgedTooFarDown = top + (int) ((matrixHeight - 1) * moduleSize) - (bottom - 1);
|
||||
if (nudgedTooFarDown > 0) {
|
||||
top -= nudgedTooFarDown;
|
||||
}
|
||||
|
||||
// Now just read off the bits
|
||||
BitMatrix bits = new BitMatrix(matrixWidth, matrixHeight);
|
||||
|
|
Loading…
Reference in a new issue