From e9c09deb08047c9e902ce37144e82b6edb8aedb6 Mon Sep 17 00:00:00 2001 From: NRK Date: Sun, 9 Oct 2022 12:56:57 +0600 Subject: [PATCH] TGA loader: fix indexing in tgaflip `y` needs to be multiplied by the width, not the height. ref: https://codeberg.org/nsxiv/nsxiv/issues/378 --- src/modules/loaders/loader_tga.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/loaders/loader_tga.c b/src/modules/loaders/loader_tga.c index 992a8d8..e0312fa 100644 --- a/src/modules/loaders/loader_tga.c +++ b/src/modules/loaders/loader_tga.c @@ -481,9 +481,9 @@ tgaflip(uint32_t * in, int w, int h, int fliph, int flipv) x2 = fliph ? w - 1 : 0; for (x = 0; x < nx; x++, x2 += dx) { - tmp = in[y * h + x]; - in[y * h + x] = in[y2 * h + x2]; - in[y2 * h + x2] = tmp; + tmp = in[y * w + x]; + in[y * w + x] = in[y2 * w + x2]; + in[y2 * w + x2] = tmp; } } }