X-Git-Url: http://git.rot13.org/?p=zxing.git;a=blobdiff_plain;f=cpp%2Fcore%2Fsrc%2Fzxing%2Fqrcode%2Fdetector%2FAlignmentPatternFinder.cpp;h=1f76491892e88a2bc81d0da2d755245b6489734f;hp=bc4aaac364419aba7ee0f0b354ba38736d20a896;hb=d59aa5593ed5a911b1141be85d1888088c21e859;hpb=269eca430e865769973f91653e23c0f1dec386a7 diff --git a/cpp/core/src/zxing/qrcode/detector/AlignmentPatternFinder.cpp b/cpp/core/src/zxing/qrcode/detector/AlignmentPatternFinder.cpp index bc4aaac3..1f764918 100644 --- a/cpp/core/src/zxing/qrcode/detector/AlignmentPatternFinder.cpp +++ b/cpp/core/src/zxing/qrcode/detector/AlignmentPatternFinder.cpp @@ -37,7 +37,7 @@ float AlignmentPatternFinder::centerFromEnd(vector &stateCount, int end) { bool AlignmentPatternFinder::foundPatternCross(vector &stateCount) { float maxVariance = moduleSize_ / 2.0f; for (size_t i = 0; i < 3; i++) { - if (labs(moduleSize_ - stateCount[i]) >= maxVariance) { + if (abs(moduleSize_ - stateCount[i]) >= maxVariance) { return false; } } @@ -86,7 +86,7 @@ float AlignmentPatternFinder::crossCheckVertical(size_t startI, size_t centerJ, } int stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2]; - if (5 * labs(stateCountTotal - originalStateCountTotal) >= 2 * originalStateCountTotal) { + if (5 * abs(stateCountTotal - originalStateCountTotal) >= 2 * originalStateCountTotal) { return NAN; } @@ -112,15 +112,19 @@ Ref AlignmentPatternFinder::handlePossibleCenter(vector & // Hadn't found this before; save it tmp->retain(); possibleCenters_->push_back(tmp); + if (callback_ != 0) { + callback_->foundPossibleResultPoint(*tmp); + } } Ref result; return result; } AlignmentPatternFinder::AlignmentPatternFinder(Ref image, size_t startX, size_t startY, size_t width, - size_t height, float moduleSize) : + size_t height, float moduleSize, + Refconst& callback) : image_(image), possibleCenters_(new vector ()), startX_(startX), startY_(startY), - width_(width), height_(height), moduleSize_(moduleSize) { + width_(width), height_(height), moduleSize_(moduleSize), callback_(callback) { } AlignmentPatternFinder::~AlignmentPatternFinder() {