add point(x: f32, y: f32) function

Shorter than writing `Point::new`
This commit is contained in:
Vukašin Stepanović
2023-02-16 11:20:03 +00:00
parent 868a9b26de
commit 39b4866e47
22 changed files with 113 additions and 109 deletions

View File

@@ -16,7 +16,7 @@
use crate::{
common::{BitArray, Result},
BinaryBitmap, DecodeHintType, DecodeHintValue, DecodingHintDictionary, Exceptions, Point,
point, BinaryBitmap, DecodeHintType, DecodeHintValue, DecodingHintDictionary, Exceptions,
RXingResult, RXingResultMetadataType, RXingResultMetadataValue, Reader, ResultPoint,
};
@@ -117,10 +117,8 @@ pub trait OneDReader: Reader {
// And remember to flip the result points horizontally.
let points = result.getPointsMut();
if !points.is_empty() && points.len() >= 2 {
points[0] =
Point::new(width as f32 - points[0].getX() - 1.0, points[0].getY());
points[1] =
Point::new(width as f32 - points[1].getX() - 1.0, points[1].getY());
points[0] = point(width as f32 - points[0].getX() - 1.0, points[0].getY());
points[1] = point(width as f32 - points[1].getX() - 1.0, points[1].getY());
}
}
return Ok(result);