return bits_;
}
void BitArray::reverse() {
- unsigned int allBits = numeric_limits<unsigned int>::max();
- size_t max = bits_.size();
- for (size_t i = 0; i < max; i++) {
- bits_[i] = bits_[i] ^ allBits;
+ std::vector<unsigned int> newBits(bits_.size(),(const unsigned int) 0);
+ for (size_t i = 0; i < size_; i++) {
+ if (get(size_ - i - 1)) {
+ newBits[i >> logBits_] |= 1<< (i & bitsMask_);
+ }
}
+ bits_ = newBits;
}
}
#include "OneDReader.h"
#include <zxing/ReaderException.h>
+#include <zxing/oned/OneDResultPoint.h>
#include <math.h>
#include <limits.h>
row = image->getBlackRow(rowNumber, row);
}catch (ReaderException re) {
continue;
+ }catch (IllegalArgumentException re) {
+ continue;
}
// While we have the image data in a BitArray, it's fairly cheap to reverse it in place to
// // But it was upside down, so note that
// result.putMetadata(ResultMetadataType.ORIENTATION, new Integer(180));
// // And remember to flip the result points horizontally.
- // ResultPoint[] points = result.getResultPoints();
- // points[0] = new ResultPoint(width - points[0].getX() - 1, points[0].getY());
- // points[1] = new ResultPoint(width - points[1].getX() - 1, points[1].getY());
+ std::vector<Ref<ResultPoint> > points(result->getResultPoints());
+ if (points.size() == 2) {
+ Ref<ResultPoint> pointZero(new OneDResultPoint(width - points[0]->getX() - 1, points[0]->getY()));
+ points[0] = pointZero;
+
+ Ref<ResultPoint> pointOne(new OneDResultPoint(width - points[1]->getX() - 1, points[1]->getY()));
+ points[1] = pointOne;
+
+ result.reset(new Result(result->getText(),result->getRawBytes(),points,result->getBarcodeFormat()));
+ }
+
}
return result;
} catch (ReaderException re) {
}
}
}
- throw ReaderException("");
+ throw ReaderException("doDecode() failed");
}
unsigned int OneDReader::patternMatchVariance(int counters[], int countersSize, const int pattern[], int maxIndividualVariance) {