| 22 | namespace ZXing::QRCode { |
| 23 | |
| 24 | Result Reader::decode(const BinaryBitmap& image) const |
| 25 | { |
| 26 | #if 1 |
| 27 | if (!_hints.isPure()) |
| 28 | return FirstOrDefault(decode(image, 1)); |
| 29 | #endif |
| 30 | |
| 31 | auto binImg = image.getBitMatrix(); |
| 32 | if (binImg == nullptr) |
| 33 | return {}; |
| 34 | |
| 35 | DetectorResult detectorResult; |
| 36 | if (_hints.hasFormat(BarcodeFormat::QRCode)) |
| 37 | detectorResult = DetectPureQR(*binImg); |
| 38 | if (_hints.hasFormat(BarcodeFormat::MicroQRCode) && !detectorResult.isValid()) |
| 39 | detectorResult = DetectPureMQR(*binImg); |
| 40 | |
| 41 | if (!detectorResult.isValid()) |
| 42 | return {}; |
| 43 | |
| 44 | auto decoderResult = Decode(detectorResult.bits()); |
| 45 | auto position = detectorResult.position(); |
| 46 | |
| 47 | return Result(std::move(decoderResult), std::move(position), |
| 48 | detectorResult.bits().width() < 21 ? BarcodeFormat::MicroQRCode : BarcodeFormat::QRCode); |
| 49 | } |
| 50 | |
| 51 | void logFPSet(const FinderPatternSet& fps [[maybe_unused]]) |
| 52 | { |
nothing calls this directly
no test coverage detected