aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortobtoht <tob@featherwallet.org>2026-06-15 14:41:50 +0000
committertobtoht <tob@featherwallet.org>2026-06-15 14:41:50 +0000
commitaf56df631270447027b341698e4a3309d8ea2f4e (patch)
tree3161ccabecd8b86be8d0182b41fea974cc7419a4 /src
parentfbc0f2eda0a740c68b75161195ac60cb6aa28263 (diff)
parentbe9eadefcfaca08651ca13cca970e09fd8c4066f (diff)
downloadmonzero-gui-af56df631270447027b341698e4a3309d8ea2f4e.tar.gz
monzero-gui-af56df631270447027b341698e4a3309d8ea2f4e.tar.xz
monzero-gui-af56df631270447027b341698e4a3309d8ea2f4e.zip
Merge pull request #4597
be9eade QR: skip QImage padding when filling quirc buffer (selsta) ACKs: plowsof
Diffstat (limited to 'src')
-rw-r--r--src/QR-Code-scanner/Decoder.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/QR-Code-scanner/Decoder.cpp b/src/QR-Code-scanner/Decoder.cpp
index 25ef0f04..57100006 100644
--- a/src/QR-Code-scanner/Decoder.cpp
+++ b/src/QR-Code-scanner/Decoder.cpp
@@ -28,6 +28,7 @@
#include "Decoder.h"
+#include <cstring>
#include <limits>
#include "quirc.h"
@@ -67,11 +68,14 @@ std::vector<std::string> QrDecoder::decodeGrayscale8(const QImage &image)
{
throw std::runtime_error("QUIRC: failed to get image buffer");
}
-#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
- std::copy(image.constBits(), image.constBits() + image.sizeInBytes(), rawImage);
-#else
- std::copy(image.constBits(), image.constBits() + image.byteCount(), rawImage);
-#endif
+
+ const int width = image.width();
+ const int height = image.height();
+ for (int y = 0; y < height; ++y)
+ {
+ std::memcpy(rawImage + y * width, image.constScanLine(y), width);
+ }
+
quirc_end(m_qr);
const int count = quirc_count(m_qr);