mirror of
https://github.com/zxing/zxing.git
synced 2025-02-02 05:41:08 -08:00
More small improvements to SKIP_N_BARCODES -- now remembers value across invocations of doDecode()
git-svn-id: https://zxing.googlecode.com/svn/trunk@305 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
93054c2213
commit
eec9cd339f
|
@ -69,14 +69,6 @@ public abstract class AbstractOneDReader implements OneDReader {
|
||||||
|
|
||||||
BitArray row = new BitArray(width);
|
BitArray row = new BitArray(width);
|
||||||
|
|
||||||
int barcodesToSkip = 0;
|
|
||||||
if (hints != null) {
|
|
||||||
Integer number = (Integer) hints.get(DecodeHintType.SKIP_N_BARCODES);
|
|
||||||
if (number != null) {
|
|
||||||
barcodesToSkip = number.intValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// We're going to examine rows from the middle outward, searching alternately above and below the middle,
|
// We're going to examine rows from the middle outward, searching alternately above and below the middle,
|
||||||
// and farther out each time. rowStep is the number of rows between each successive attempt above and below
|
// and farther out each time. rowStep is the number of rows between each successive attempt above and below
|
||||||
// the middle. So we'd scan row middle, then middle - rowStep, then middle + rowStep,
|
// the middle. So we'd scan row middle, then middle - rowStep, then middle + rowStep,
|
||||||
|
@ -95,6 +87,7 @@ public abstract class AbstractOneDReader implements OneDReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
Hashtable lastResults = null;
|
Hashtable lastResults = null;
|
||||||
|
boolean skippingSomeBarcodes = hints != null && hints.containsKey(DecodeHintType.SKIP_N_BARCODES);
|
||||||
|
|
||||||
for (int x = 0; x < maxLines; x++) {
|
for (int x = 0; x < maxLines; x++) {
|
||||||
|
|
||||||
|
@ -136,8 +129,14 @@ public abstract class AbstractOneDReader implements OneDReader {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (barcodesToSkip > 0) { // See if we should skip and keep looking
|
if (skippingSomeBarcodes) { // See if we should skip and keep looking
|
||||||
barcodesToSkip--;
|
int oldValue = ((Integer) hints.get(DecodeHintType.SKIP_N_BARCODES)).intValue();
|
||||||
|
if (oldValue > 1) {
|
||||||
|
hints.put(DecodeHintType.SKIP_N_BARCODES, new Integer(oldValue - 1));
|
||||||
|
} else {
|
||||||
|
hints.remove(DecodeHintType.SKIP_N_BARCODES);
|
||||||
|
skippingSomeBarcodes = false;
|
||||||
|
}
|
||||||
if (lastResults == null) {
|
if (lastResults == null) {
|
||||||
lastResults = new Hashtable(3);
|
lastResults = new Hashtable(3);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue