mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-27 21:02:35 +00:00
Merge branch 'main' into pr/point_refactor
This commit is contained in:
@@ -103,7 +103,7 @@ impl<'a> Detector<'_> {
|
||||
|
||||
let moduleSize = self.calculateModuleSize(topLeft, topRight, bottomLeft);
|
||||
if moduleSize < 1.0 {
|
||||
return Err(Exceptions::NotFoundException(None));
|
||||
return Err(Exceptions::notFound);
|
||||
}
|
||||
let dimension = Self::computeDimension(topLeft, topRight, bottomLeft, moduleSize)?;
|
||||
let provisionalVersion = Version::getProvisionalVersionForDimension(dimension)?;
|
||||
@@ -145,7 +145,7 @@ impl<'a> Detector<'_> {
|
||||
alignmentPattern.as_ref(),
|
||||
dimension,
|
||||
)
|
||||
.ok_or(Exceptions::NotFoundException(None))?;
|
||||
.ok_or(Exceptions::notFound)?;
|
||||
|
||||
let bits = Detector::sampleGrid(self.image, &transform, dimension)?;
|
||||
|
||||
@@ -156,11 +156,7 @@ impl<'a> Detector<'_> {
|
||||
];
|
||||
|
||||
if alignmentPattern.is_some() {
|
||||
points.push(
|
||||
alignmentPattern
|
||||
.ok_or(Exceptions::NotFoundException(None))?
|
||||
.into(),
|
||||
)
|
||||
points.push(alignmentPattern.ok_or(Exceptions::notFound)?.into())
|
||||
}
|
||||
|
||||
Ok(QRCodeDetectorResult::new(bits, points))
|
||||
@@ -244,7 +240,7 @@ impl<'a> Detector<'_> {
|
||||
match dimension & 0x03 {
|
||||
0 => dimension += 1,
|
||||
2 => dimension -= 1,
|
||||
3 => return Err(Exceptions::NotFoundException(None)),
|
||||
3 => return Err(Exceptions::notFound),
|
||||
_ => {}
|
||||
}
|
||||
Ok(dimension as u32)
|
||||
@@ -440,13 +436,13 @@ impl<'a> Detector<'_> {
|
||||
let alignmentAreaLeftX = 0.max(estAlignmentX as i32 - allowance as i32) as u32;
|
||||
let alignmentAreaRightX = (self.image.getWidth() - 1).min(estAlignmentX + allowance);
|
||||
if ((alignmentAreaRightX - alignmentAreaLeftX) as f32) < overallEstModuleSize * 3.0 {
|
||||
return Err(Exceptions::NotFoundException(None));
|
||||
return Err(Exceptions::notFound);
|
||||
}
|
||||
|
||||
let alignmentAreaTopY = 0.max(estAlignmentY as i32 - allowance as i32) as u32;
|
||||
let alignmentAreaBottomY = (self.image.getHeight() - 1).min(estAlignmentY + allowance);
|
||||
if alignmentAreaBottomY - alignmentAreaTopY < overallEstModuleSize as u32 * 3 {
|
||||
return Err(Exceptions::NotFoundException(None));
|
||||
return Err(Exceptions::notFound);
|
||||
}
|
||||
|
||||
let mut alignmentFinder = AlignmentPatternFinder::new(
|
||||
|
||||
Reference in New Issue
Block a user