Draft of 'thinking' visualization for barcode scanning. Works for 1D and QR codes.
[zxing.git] / core / src / com / google / zxing / oned / EAN8Reader.java
index 08983c8..bb80112 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Google Inc.
+ * Copyright 2008 ZXing authors
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -23,13 +23,23 @@ import com.google.zxing.common.BitArray;
 /**
  * <p>Implements decoding of the EAN-8 format.</p>
  *
- * @author srowen@google.com (Sean Owen)
+ * @author Sean Owen
  */
 public final class EAN8Reader extends AbstractUPCEANReader {
 
-  protected int decodeMiddle(BitArray row, int[] startRange, StringBuffer result) throws ReaderException {
+  private final int[] decodeMiddleCounters;
 
-    int[] counters = new int[4];
+  public EAN8Reader() {
+    decodeMiddleCounters = new int[4];
+  }
+
+  protected int decodeMiddle(BitArray row, int[] startRange, StringBuffer result)
+      throws ReaderException {
+    int[] counters = decodeMiddleCounters;
+    counters[0] = 0;
+    counters[1] = 0;
+    counters[2] = 0;
+    counters[3] = 0;
     int end = row.getSize();
     int rowOffset = startRange[1];