mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 04:12:34 +00:00
port SymbologyIdentifier test
This commit is contained in:
@@ -297,7 +297,7 @@ pub fn DecodeBitStream(
|
||||
let mut structuredAppend = StructuredAppendInfo::default();
|
||||
let modeBitLength = Mode::get_codec_mode_bits_length(version);
|
||||
|
||||
let _res = (|| {
|
||||
let res = (|| {
|
||||
while (!IsEndOfStream(&mut bits, version)?) {
|
||||
let mode: Mode;
|
||||
if (modeBitLength == 0) {
|
||||
@@ -380,23 +380,13 @@ pub fn DecodeBitStream(
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
})()?;
|
||||
// } catch (std::out_of_range& e) { // see BitSource::readBits
|
||||
// error = FormatError("Truncated bit stream");
|
||||
// } catch (Error e) {
|
||||
// error = std::move(e);
|
||||
// }
|
||||
})();
|
||||
|
||||
Ok(DecoderResult::with_eci_string_builder(result)
|
||||
.withError(res.err())
|
||||
.withEcLevel(ecLevel.to_string())
|
||||
.withVersionNumber(version.getVersionNumber())
|
||||
.withStructuredAppend(structuredAppend))
|
||||
|
||||
// return DecoderResult(std::move(result))
|
||||
// .setError(std::move(error))
|
||||
// .setEcLevel(ToString(ecLevel))
|
||||
// .setVersionNumber(version.versionNumber())
|
||||
// .setStructuredAppend(structuredAppend);
|
||||
}
|
||||
|
||||
pub fn Decode(bits: &BitMatrix) -> Result<DecoderResult<bool>> {
|
||||
|
||||
@@ -308,6 +308,7 @@ pub fn EstimateDimension(
|
||||
}
|
||||
}
|
||||
|
||||
/// This function can panic
|
||||
pub fn TraceLine(image: &BitMatrix, p: Point, d: Point, edge: i32) -> impl RegressionLineTrait {
|
||||
let mut cur = EdgeTracer::new(image, p, d - p);
|
||||
let mut line = RegressionLine::default();
|
||||
@@ -337,7 +338,8 @@ pub fn TraceLine(image: &BitMatrix, p: Point, d: Point, edge: i32) -> impl Regre
|
||||
let mut c = EdgeTracer::new(image, curI.p, curI.direction(dir));
|
||||
let stepCount = (Point::maxAbsComponent(cur.p - p)) as i32;
|
||||
loop {
|
||||
line.add(Point::centered(c.p));
|
||||
line.add(Point::centered(c.p))
|
||||
.expect("could not add point on line");
|
||||
|
||||
if !(--stepCount > 0 && c.stepAlongEdge(dir, Some(true))) {
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user