commit cb06503daca4d167c0f45050f69e01e6c69d8e0e parent 895612309e3a1c33f435a832888f6dae6783c48e Author: Christian Grothoff <christian@grothoff.org> Date: Sat, 16 Nov 2019 11:10:05 +0100 see stuff Diffstat:
| M | src/main.c | | | 8 | ++++++-- |
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/main.c b/src/main.c @@ -256,8 +256,12 @@ show_qrcode (const char *uri) for (unsigned int x = 0; x < qrDisplay.var_info.xres - 2 * xOff; x++) for (unsigned int y = 0; y < qrDisplay.var_info.yres - 2 * yOff; y++) { - unsigned int off = - (x * nwidth / size) + (y * nwidth / size) * qrc->width; + unsigned int xoff = x * nwidth / size; + unsigned int yoff = y * nwidth / size; + unsigned int off = xoff + yoff * qrc->width; + if ( (xoff >= qrc->width) || + (yoff >= qrc->width) ) + continue; qrDisplay.memory[(y + yOff) * qrDisplay.var_info.xres + (x + xOff)] = (0 == (qrc->data[off] & 1)) ? 0xFFFF : 0x0000; }