Commit 1ccc2eaf authored by Volker Krause's avatar Volker Krause

Fix build with latest ZXing

This is a bit ugly and not as efficient as it probably could be, but it
should give us a working build (and working barcode decoding) on binary
factory again.
parent 0e287b70
......@@ -59,6 +59,28 @@ bool QImagePureBinarizer::getBlackRow(int y, ZXing::BitArray &row) const
return true;
}
#if ZXING_VERSION >= QT_VERSION_CHECK(1, 1, 1)
bool QImagePureBinarizer::getPatternRow(int y, ZXing::PatternRow& res) const
{
res.clear();
// TODO we can probably skip this indirection eventually and directly access image data here?
ZXing::BitArray row;
getBlackRow(y, row);
auto li = row.begin();
auto i = li;
if (*i) {
res.push_back(0);
}
while ((i = row.getNextSetTo(i, !*i)) != row.end()) {
res.push_back(static_cast<ZXing::PatternRow::value_type>(i - li));
li = i;
}
res.push_back(static_cast<ZXing::PatternRow::value_type>(i - li));
return true;
}
#endif
std::shared_ptr<const ZXing::BitMatrix> QImagePureBinarizer::getBlackMatrix() const
{
using namespace ZXing;
......
......@@ -31,7 +31,15 @@ public:
int width() const override;
bool isPureBarcode() const override;
bool getBlackRow(int y, ZXing::BitArray &row) const override;
bool getBlackRow(int y, ZXing::BitArray &row) const
#if ZXING_VERSION < QT_VERSION_CHECK(1, 1, 1)
// no longer present in later versions of 1.1.1...
override
#endif
;
#if ZXING_VERSION >= QT_VERSION_CHECK(1, 1, 1)
bool getPatternRow(int y, ZXing::PatternRow& res) const override;
#endif
std::shared_ptr<const ZXing::BitMatrix> getBlackMatrix() const override;
bool canCrop() const override;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment