mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Fixed a bug I introduced while removing exceptions, which caused the
x coordinate of 1D barcodes to always be flipped, as if they had been read upside down. git-svn-id: https://zxing.googlecode.com/svn/trunk@1547 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
439ff92bd9
commit
f9bc448926
|
@ -97,7 +97,7 @@ namespace zxing {
|
||||||
// While we have the image data in a BitArray, it's fairly cheap to reverse it in place to
|
// While we have the image data in a BitArray, it's fairly cheap to reverse it in place to
|
||||||
// handle decoding upside down barcodes.
|
// handle decoding upside down barcodes.
|
||||||
for (int attempt = 0; attempt < 2; attempt++) {
|
for (int attempt = 0; attempt < 2; attempt++) {
|
||||||
if (attempt == 1) { // trying again?
|
if (attempt == 1) {
|
||||||
row->reverse(); // reverse the row and continue
|
row->reverse(); // reverse the row and continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,9 +105,10 @@ namespace zxing {
|
||||||
Ref<Result> result = decodeRow(rowNumber, row);
|
Ref<Result> result = decodeRow(rowNumber, row);
|
||||||
// We found our barcode
|
// We found our barcode
|
||||||
if (!result.empty()) {
|
if (!result.empty()) {
|
||||||
// // But it was upside down, so note that
|
if (attempt == 1) {
|
||||||
|
// But it was upside down, so note that
|
||||||
// result.putMetadata(ResultMetadataType.ORIENTATION, new Integer(180));
|
// result.putMetadata(ResultMetadataType.ORIENTATION, new Integer(180));
|
||||||
// // And remember to flip the result points horizontally.
|
// And remember to flip the result points horizontally.
|
||||||
std::vector<Ref<ResultPoint> > points(result->getResultPoints());
|
std::vector<Ref<ResultPoint> > points(result->getResultPoints());
|
||||||
// if there's exactly two points (which there should be), flip the x coordinate
|
// if there's exactly two points (which there should be), flip the x coordinate
|
||||||
// if there's not exactly 2, I don't know what do do with it
|
// if there's not exactly 2, I don't know what do do with it
|
||||||
|
@ -123,6 +124,7 @@ namespace zxing {
|
||||||
result.reset(new Result(result->getText(), result->getRawBytes(), points,
|
result.reset(new Result(result->getText(), result->getRawBytes(), points,
|
||||||
result->getBarcodeFormat()));
|
result->getBarcodeFormat()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue