mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 12:22:34 +00:00
rename helper methods
This commit is contained in:
@@ -83,7 +83,7 @@ impl Reader for QRCodeReader {
|
||||
// if (decoderRXingResult.getOther() instanceof QRCodeDecoderMetaData) {
|
||||
other
|
||||
.downcast_ref::<QRCodeDecoderMetaData>()
|
||||
.ok_or(Exceptions::illegalStateEmpty())?
|
||||
.ok_or(Exceptions::illegalState)?
|
||||
.applyMirroredCorrection(&mut points);
|
||||
}
|
||||
}
|
||||
@@ -153,11 +153,11 @@ impl QRCodeReader {
|
||||
let leftTopBlack = image.getTopLeftOnBit();
|
||||
let rightBottomBlack = image.getBottomRightOnBit();
|
||||
if leftTopBlack.is_none() || rightBottomBlack.is_none() {
|
||||
return Err(Exceptions::notFoundEmpty());
|
||||
return Err(Exceptions::notFound);
|
||||
}
|
||||
|
||||
let leftTopBlack = leftTopBlack.ok_or(Exceptions::indexOutOfBoundsEmpty())?;
|
||||
let rightBottomBlack = rightBottomBlack.ok_or(Exceptions::indexOutOfBoundsEmpty())?;
|
||||
let leftTopBlack = leftTopBlack.ok_or(Exceptions::indexOutOfBounds)?;
|
||||
let rightBottomBlack = rightBottomBlack.ok_or(Exceptions::indexOutOfBounds)?;
|
||||
|
||||
let moduleSize = Self::moduleSize(&leftTopBlack, image)?;
|
||||
|
||||
@@ -168,7 +168,7 @@ impl QRCodeReader {
|
||||
|
||||
// Sanity check!
|
||||
if left >= right || top >= bottom {
|
||||
return Err(Exceptions::notFoundEmpty());
|
||||
return Err(Exceptions::notFound);
|
||||
}
|
||||
|
||||
if bottom - top != right - left {
|
||||
@@ -177,17 +177,17 @@ impl QRCodeReader {
|
||||
right = left + (bottom - top);
|
||||
if right >= image.getWidth() as i32 {
|
||||
// Abort if that would not make sense -- off image
|
||||
return Err(Exceptions::notFoundEmpty());
|
||||
return Err(Exceptions::notFound);
|
||||
}
|
||||
}
|
||||
let matrixWidth = ((right as f32 - left as f32 + 1.0) / moduleSize).round() as u32;
|
||||
let matrixHeight = ((bottom as f32 - top as f32 + 1.0) / moduleSize).round() as u32;
|
||||
if matrixWidth == 0 || matrixHeight == 0 {
|
||||
return Err(Exceptions::notFoundEmpty());
|
||||
return Err(Exceptions::notFound);
|
||||
}
|
||||
if matrixHeight != matrixWidth {
|
||||
// Only possibly decode square regions
|
||||
return Err(Exceptions::notFoundEmpty());
|
||||
return Err(Exceptions::notFound);
|
||||
}
|
||||
|
||||
// Push in the "border" by half the module width so that we start
|
||||
@@ -205,7 +205,7 @@ impl QRCodeReader {
|
||||
if nudgedTooFarRight > 0 {
|
||||
if nudgedTooFarRight > nudge as i32 {
|
||||
// Neither way fits; abort
|
||||
return Err(Exceptions::notFoundEmpty());
|
||||
return Err(Exceptions::notFound);
|
||||
}
|
||||
left -= nudgedTooFarRight;
|
||||
}
|
||||
@@ -214,7 +214,7 @@ impl QRCodeReader {
|
||||
if nudgedTooFarDown > 0 {
|
||||
if nudgedTooFarDown > nudge as i32 {
|
||||
// Neither way fits; abort
|
||||
return Err(Exceptions::notFoundEmpty());
|
||||
return Err(Exceptions::notFound);
|
||||
}
|
||||
top -= nudgedTooFarDown;
|
||||
}
|
||||
@@ -251,7 +251,7 @@ impl QRCodeReader {
|
||||
y += 1;
|
||||
}
|
||||
if x == width || y == height {
|
||||
return Err(Exceptions::notFoundEmpty());
|
||||
return Err(Exceptions::notFound);
|
||||
}
|
||||
Ok((x - leftTopBlack[0]) as f32 / 7.0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user