swap point_f and point functions

This commit is contained in:
Henry Schimke
2023-05-04 14:50:32 -05:00
parent 80f06ecb3c
commit 3fc068f49b
38 changed files with 210 additions and 217 deletions

View File

@@ -18,7 +18,7 @@ use std::rc::Rc;
use crate::{
common::{BitMatrix, Result},
point, Exceptions, Point,
point_f, Exceptions, Point,
};
/**
@@ -58,13 +58,13 @@ impl BoundingBox {
if leftUnspecified {
newTopRight = topRight.ok_or(Exceptions::ILLEGAL_STATE)?;
newBottomRight = bottomRight.ok_or(Exceptions::ILLEGAL_STATE)?;
newTopLeft = point(0.0, newTopRight.y);
newBottomLeft = point(0.0, newBottomRight.y);
newTopLeft = point_f(0.0, newTopRight.y);
newBottomLeft = point_f(0.0, newBottomRight.y);
} else if rightUnspecified {
newTopLeft = topLeft.ok_or(Exceptions::ILLEGAL_STATE)?;
newBottomLeft = bottomLeft.ok_or(Exceptions::ILLEGAL_STATE)?;
newTopRight = point(image.getWidth() as f32 - 1.0, newTopLeft.y);
newBottomRight = point(image.getWidth() as f32 - 1.0, newBottomLeft.y);
newTopRight = point_f(image.getWidth() as f32 - 1.0, newTopLeft.y);
newBottomRight = point_f(image.getWidth() as f32 - 1.0, newBottomLeft.y);
} else {
newTopLeft = topLeft.ok_or(Exceptions::ILLEGAL_STATE)?;
newTopRight = topRight.ok_or(Exceptions::ILLEGAL_STATE)?;
@@ -138,7 +138,7 @@ impl BoundingBox {
if newMinY < 0.0 {
newMinY = 0.0;
}
let newTop = point(top.x, newMinY);
let newTop = point_f(top.x, newMinY);
if isLeft {
newTopLeft = newTop;
} else {
@@ -156,7 +156,7 @@ impl BoundingBox {
if newMaxY >= self.image.getHeight() {
newMaxY = self.image.getHeight() - 1;
}
let newBottom = point(bottom.x, newMaxY as f32);
let newBottom = point_f(bottom.x, newMaxY as f32);
if isLeft {
newBottomLeft = newBottom;
} else {

View File

@@ -16,7 +16,7 @@
use crate::{
common::{BitMatrix, Result},
point, Binarizer, BinaryBitmap, DecodingHintDictionary, Exceptions, Point,
point_f, Binarizer, BinaryBitmap, DecodingHintDictionary, Exceptions, Point,
};
use std::borrow::Cow;
@@ -244,8 +244,8 @@ fn findRowsWithPattern(
break;
}
}
result[0] = Some(point(loc_store.as_ref()?[0] as f32, startRow as f32));
result[1] = Some(point(loc_store.as_ref()?[1] as f32, startRow as f32));
result[0] = Some(point_f(loc_store.as_ref()?[0] as f32, startRow as f32));
result[1] = Some(point_f(loc_store.as_ref()?[1] as f32, startRow as f32));
found = true;
break;
}
@@ -290,8 +290,8 @@ fn findRowsWithPattern(
stopRow += 1;
}
stopRow -= skippedRowCount + 1;
result[2] = Some(point(previousRowLoc[0] as f32, stopRow as f32));
result[3] = Some(point(previousRowLoc[1] as f32, stopRow as f32));
result[2] = Some(point_f(previousRowLoc[0] as f32, stopRow as f32));
result[3] = Some(point_f(previousRowLoc[1] as f32, stopRow as f32));
}
if stopRow - startRow < BARCODE_MIN_HEIGHT {
result.fill(None);