commit 79ed7e22696f9fae6f8d117d924baa837b13ee25
parent 2bb162be67130e4d1d1ff6253e4b3a2ab6288cbf
Author: Christian Grothoff <christian@grothoff.org>
Date: Sat, 16 Nov 2019 10:42:57 +0100
swap xy
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/main.c b/src/main.c
@@ -244,7 +244,8 @@ show_qrcode (const char *uri)
size = GNUNET_MIN (qrDisplay.var_info.xres,
qrDisplay.var_info.yres);
size /= 2;
- scale = size / (qrc->width + 8);
+ unsigned int width = qrc->width + 8; // 4 pixel border
+ scale = size / width;
#if LEGACY
pixels = GNUNET_malloc (size * size * n_channels);
#endif
@@ -259,7 +260,7 @@ show_qrcode (const char *uri)
{
unsigned int off =
(x * qrc->width / size) + (y * qrc->width / size) * qrc->width;
- qrDisplay.memory[(y + yOff) * qrDisplay.var_info.xres + (x + xOff)] =
+ qrDisplay.memory[(y + yOff) + qrDisplay.var_info.yres * (x + xOff)] =
(0 == (qrc->data[off] & 1)) ? 0xFFFF : 0x0000;
}
@@ -354,7 +355,7 @@ cleanup_payment (struct PaymentActivity *pa)
{
for (size_t col = 0; col < qrDisplay.var_info.xres; col++)
{
- qrDisplay.memory[(row * qrDisplay.var_info.xres + col)] = 0xFF;
+ qrDisplay.memory[(row * qrDisplay.var_info.xres + col)] = 0xFFFF;
}
}
}