mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-28 05:12:34 +00:00
we really should be using round, but why is it worse?
This commit is contained in:
@@ -2363,7 +2363,7 @@ impl GridSampler for DefaultGridSampler {
|
|||||||
let mut x = 0;
|
let mut x = 0;
|
||||||
while x < max {
|
while x < max {
|
||||||
// for (int x = 0; x < max; x += 2) {
|
// for (int x = 0; x < max; x += 2) {
|
||||||
if image.get(points[x].floor() as u32, points[x + 1].floor() as u32) {
|
if image.get(points[x].round() as u32, points[x + 1].round() as u32) {
|
||||||
// Black(-ish) pixel
|
// Black(-ish) pixel
|
||||||
bits.set(x as u32 / 2, y);
|
bits.set(x as u32 / 2, y);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ impl AlignmentPatternFinder {
|
|||||||
let centerJ = Self::centerFromEnd(stateCount, j);
|
let centerJ = Self::centerFromEnd(stateCount, j);
|
||||||
let centerI = self.crossCheckVertical(
|
let centerI = self.crossCheckVertical(
|
||||||
i,
|
i,
|
||||||
centerJ.floor() as u32,
|
centerJ.round() as u32,
|
||||||
2 * stateCount[1],
|
2 * stateCount[1],
|
||||||
stateCountTotal,
|
stateCountTotal,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ impl FinderPattern {
|
|||||||
combinedX,
|
combinedX,
|
||||||
combinedY,
|
combinedY,
|
||||||
combinedModuleSize,
|
combinedModuleSize,
|
||||||
combinedCount.floor() as usize,
|
combinedCount.round() as usize,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -620,7 +620,7 @@ impl FinderPatternFinder {
|
|||||||
return (((fnp.getX() - center.getX().abs())
|
return (((fnp.getX() - center.getX().abs())
|
||||||
- (fnp.getY() - center.getY()).abs())
|
- (fnp.getY() - center.getY()).abs())
|
||||||
/ 2.0)
|
/ 2.0)
|
||||||
.floor() as u32;
|
.round() as u32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user