Port additional Issue 1776 changes

git-svn-id: https://zxing.googlecode.com/svn/trunk@2890 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen@gmail.com 2013-09-09 07:42:23 +00:00
parent 9a6ac33760
commit 7606df6da0
3 changed files with 11 additions and 3 deletions

View file

@ -434,6 +434,8 @@ Ref<Result> Code128Reader::decodeRow(int rowNumber, Ref<BitArray> row) {
} }
int lastPatternSize = nextStart - lastStart;
// Check for ample whitespace following pattern, but, to do this we first need to remember that // Check for ample whitespace following pattern, but, to do this we first need to remember that
// we fudged decoding CODE_STOP since it actually has 7 bars, not 6. There is a black bar left // we fudged decoding CODE_STOP since it actually has 7 bars, not 6. There is a black bar left
// to read off. Would be slightly better to properly read. Here we just skip it: // to read off. Would be slightly better to properly read. Here we just skip it:
@ -469,7 +471,7 @@ Ref<Result> Code128Reader::decodeRow(int rowNumber, Ref<BitArray> row) {
} }
float left = (float) (startPatternInfo[1] + startPatternInfo[0]) / 2.0f; float left = (float) (startPatternInfo[1] + startPatternInfo[0]) / 2.0f;
float right = (float) (nextStart + lastStart) / 2.0f; float right = lastStart + lastPatternSize / 2.0f;
int rawCodesSize = rawCodes.size(); int rawCodesSize = rawCodes.size();
ArrayRef<char> rawBytes (rawCodesSize); ArrayRef<char> rawBytes (rawCodesSize);

View file

@ -161,7 +161,7 @@ Ref<Result> Code39Reader::decodeRow(int rowNumber, Ref<BitArray> row) {
} }
float left = (float) (start[1] + start[0]) / 2.0f; float left = (float) (start[1] + start[0]) / 2.0f;
float right = (float) (nextStart + lastStart) / 2.0f; float right = lastStart + lastPatternSize / 2.0f;
ArrayRef< Ref<ResultPoint> > resultPoints (2); ArrayRef< Ref<ResultPoint> > resultPoints (2);
resultPoints[0] = resultPoints[0] =

View file

@ -97,6 +97,12 @@ Ref<Result> Code93Reader::decodeRow(int rowNumber, Ref<BitArray> row) {
} while (decodedChar != '*'); } while (decodedChar != '*');
result.resize(result.length() - 1); // remove asterisk result.resize(result.length() - 1); // remove asterisk
// Look for whitespace after pattern:
int lastPatternSize = 0;
for (int i = 0, e = theCounters.size(); i < e; i++) {
lastPatternSize += theCounters[i];
}
// Should be at least one more black module // Should be at least one more black module
if (nextStart == end || !row->get(nextStart)) { if (nextStart == end || !row->get(nextStart)) {
throw NotFoundException(); throw NotFoundException();
@ -114,7 +120,7 @@ Ref<Result> Code93Reader::decodeRow(int rowNumber, Ref<BitArray> row) {
Ref<String> resultString = decodeExtended(result); Ref<String> resultString = decodeExtended(result);
float left = (float) (start[1] + start[0]) / 2.0f; float left = (float) (start[1] + start[0]) / 2.0f;
float right = (float) (nextStart + lastStart) / 2.0f; float right = lastStart + lastPatternSize / 2.0f;
ArrayRef< Ref<ResultPoint> > resultPoints (2); ArrayRef< Ref<ResultPoint> > resultPoints (2);
resultPoints[0] = resultPoints[0] =