mqr tests pass

This commit is contained in:
Henry Schimke
2023-04-25 12:50:54 -05:00
parent cf530422c9
commit b8b4bd523c
6 changed files with 6 additions and 3 deletions

View File

@@ -197,7 +197,7 @@ impl<'a> PatternView<'a> {
self.isValidWithN(self.size())
}
fn has_quiet_zone_before(&self, scale: f32, acceptIfAtFirstBar: Option<bool>) -> bool {
pub fn has_quiet_zone_before(&self, scale: f32, acceptIfAtFirstBar: Option<bool>) -> bool {
(acceptIfAtFirstBar.unwrap_or(false) && self.isAtLastBar())
|| Into::<f32>::into(self.data.0[self.count])
>= Into::<f32>::into(self.sum(None)) * scale

View File

@@ -1023,8 +1023,8 @@ pub fn SampleMQR(image: &BitMatrix, fp: ConcentricPattern) -> Result<QRCodeDetec
dim,
dim,
&[SamplerControl {
p0: point_i(0, dim as u32),
p1: point_i(0, dim as u32),
p1: point_i(dim as u32, dim as u32),
p0: point_i(0, 0),
transform: bestPT,
}],
)?;

View File

@@ -113,6 +113,9 @@ impl Version {
}
pub fn getECBlocksForLevel(&self, ecLevel: ErrorCorrectionLevel) -> &ECBlocks {
if ecLevel.get_ordinal() as usize >= self.ecBlocks.len() {
return &self.ecBlocks[ecLevel.get_ordinal() as usize % self.ecBlocks.len()];
}
&self.ecBlocks[ecLevel.get_ordinal() as usize]
}