* pasted and stripped down here for maximum performance but does unfortunately duplicate\r
* some code.</p>\r
*\r
- * <p>This class is not thread-safe.</p>\r
+ * <p>This class is thread-safe but not reentrant. Each thread must allocate its own object.\r
*\r
- * @author srowen@google.com (Sean Owen)\r
+ * @author Sean Owen\r
*/\r
final class AlignmentPatternFinder {\r
\r
private final int width;\r
private final int height;\r
private final float moduleSize;\r
+ private final int[] crossCheckStateCount;\r
\r
/**\r
* <p>Creates a finder that will look in a portion of the whole image.</p>\r
this.width = width;\r
this.height = height;\r
this.moduleSize = moduleSize;\r
+ this.crossCheckStateCount = new int[3];\r
}\r
\r
/**\r
return (AlignmentPattern) possibleCenters.elementAt(0);\r
}\r
\r
- throw new ReaderException("Could not find alignment pattern");\r
+ throw ReaderException.getInstance();\r
}\r
\r
/**\r
MonochromeBitmapSource image = this.image;\r
\r
int maxI = image.getHeight();\r
- int[] stateCount = new int[3];\r
+ int[] stateCount = crossCheckStateCount;\r
+ stateCount[0] = 0;\r
+ stateCount[1] = 0;\r
+ stateCount[2] = 0;\r
\r
// Start counting up from center\r
int i = startI;\r