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:
dswitkin@google.com 2010-08-18 18:31:49 +00:00
parent 439ff92bd9
commit f9bc448926

View file

@ -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
// handle decoding upside down barcodes.
for (int attempt = 0; attempt < 2; attempt++) {
if (attempt == 1) { // trying again?
if (attempt == 1) {
row->reverse(); // reverse the row and continue
}
@ -105,9 +105,10 @@ namespace zxing {
Ref<Result> result = decodeRow(rowNumber, row);
// We found our barcode
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));
// // And remember to flip the result points horizontally.
// And remember to flip the result points horizontally.
std::vector<Ref<ResultPoint> > points(result->getResultPoints());
// 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
@ -123,6 +124,7 @@ namespace zxing {
result.reset(new Result(result->getText(), result->getRawBytes(), points,
result->getBarcodeFormat()));
}
}
return result;
}
}