X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=core%2Fsrc%2Fcom%2Fgoogle%2Fzxing%2Fqrcode%2Fdetector%2FAlignmentPatternFinder.java;h=25e312b20c4443152545cbe58d49d8b380a0b3f8;hb=d71a862e30b2591c1e39332acf5c3d8391c5b582;hp=1f7ed3b9ed4207ed3e4f4228ca11e3aa3d120c86;hpb=adcb498790b50fa7fa9a76b7c823d9bdb64ff322;p=zxing.git diff --git a/core/src/com/google/zxing/qrcode/detector/AlignmentPatternFinder.java b/core/src/com/google/zxing/qrcode/detector/AlignmentPatternFinder.java index 1f7ed3b9..25e312b2 100644 --- a/core/src/com/google/zxing/qrcode/detector/AlignmentPatternFinder.java +++ b/core/src/com/google/zxing/qrcode/detector/AlignmentPatternFinder.java @@ -32,9 +32,9 @@ import java.util.Vector; * pasted and stripped down here for maximum performance but does unfortunately duplicate * some code.

* - *

This class is not thread-safe.

+ *

This class is thread-safe but not reentrant. Each thread must allocate its own object. * - * @author srowen@google.com (Sean Owen) + * @author Sean Owen */ final class AlignmentPatternFinder { @@ -45,6 +45,7 @@ final class AlignmentPatternFinder { private final int width; private final int height; private final float moduleSize; + private final int[] crossCheckStateCount; /** *

Creates a finder that will look in a portion of the whole image.

@@ -69,6 +70,7 @@ final class AlignmentPatternFinder { this.width = width; this.height = height; this.moduleSize = moduleSize; + this.crossCheckStateCount = new int[3]; } /** @@ -146,7 +148,7 @@ final class AlignmentPatternFinder { return (AlignmentPattern) possibleCenters.elementAt(0); } - throw new ReaderException("Could not find alignment pattern"); + throw ReaderException.getInstance(); } /** @@ -188,7 +190,10 @@ final class AlignmentPatternFinder { MonochromeBitmapSource image = this.image; int maxI = image.getHeight(); - int[] stateCount = new int[3]; + int[] stateCount = crossCheckStateCount; + stateCount[0] = 0; + stateCount[1] = 0; + stateCount[2] = 0; // Start counting up from center int i = startI;