This commit is contained in:
Henry Schimke
2023-03-21 10:16:46 -05:00
parent 2b3ed37924
commit 890fb4901f
4 changed files with 9 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "rxing"
version = "0.4.2"
version = "0.4.3"
description="A rust port of the zxing barcode library."
license="Apache-2.0"
repository="https://github.com/rxing-core/rxing"

View File

@@ -265,6 +265,11 @@ impl BitMatrix {
(self.get_offset(y, x)) >= self.bits.len()
}
/// Confusingly returns true if the requested element is out of bounds
pub fn check_point_in_bounds(&self, point: Point) -> bool {
self.check_in_bounds(point.x as u32, point.y as u32)
}
/**
* <p>Sets the given bit to true.</p>
*

View File

@@ -281,9 +281,7 @@ impl Circle<'_> {
// count left
while {
let point = get_point(self.center, (x, y), rotation);
!self.image.check_in_bounds(point.x as u32, point.y as u32)
&& !self.image.get(point.x as u32, point.y as u32)
&& x > 0
!self.image.check_point_in_bounds(point) && !self.image.get_point(point) && x > 0
} {
x -= 1;
length += 1;
@@ -295,8 +293,7 @@ impl Circle<'_> {
// count right
while {
let point = get_point(self.center, (x, y), rotation);
!self.image.check_in_bounds(point.x as u32, point.y as u32)
&& !self.image.get(point.x as u32, point.y as u32)
!self.image.check_point_in_bounds(point) && !self.image.get_point(point)
} {
x += 1;
length += 1;

View File

@@ -5,7 +5,7 @@ use rxing::DecodingHintDictionary;
#[test]
fn issue_27_part_2() {
let mut data = Vec::new();
std::fs::File::open("test_resources/blackbox/github_issue_cases/226611447-be6041dc-5b21-42fe-827b-068ccc59082c.png")
std::fs::File::open("test_resources/blackbox/github_issue_cases/panic_data2_issue_27.bin")
.unwrap()
.read_to_end(&mut data)
.unwrap();