From ae0d63ccc01579fb5f4ea2549b634fc206cf2a57 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 19 Aug 2020 18:16:57 +0200 Subject: [PATCH] Revert "Optimize png_reverse_filter_copy_line_rgba" This reverts commit ad3c67f2752e1c32be673e5447f386cf6d390fd7. --- libretro-common/formats/png/rpng.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/libretro-common/formats/png/rpng.c b/libretro-common/formats/png/rpng.c index c958ef833b..1c741dfc6d 100644 --- a/libretro-common/formats/png/rpng.c +++ b/libretro-common/formats/png/rpng.c @@ -248,18 +248,22 @@ static void png_reverse_filter_copy_line_rgb(uint32_t *data, static void png_reverse_filter_copy_line_rgba(uint32_t *data, const uint8_t *decoded, unsigned width, unsigned bpp) { - uint32_t *data_ptr = NULL; + unsigned i; bpp /= 8; - for (data_ptr = &data[0]; data_ptr < data + width; data_ptr++) + for (i = 0; i < width; i++) { - uint32_t r = *(decoded); - uint32_t g = *(decoded + bpp); - uint32_t b = *(decoded + bpp + bpp); - uint32_t a = *(decoded + bpp + bpp + bpp); - decoded += (4 * bpp); - *data_ptr = (a << 24) | (r << 16) | (g << 8) | (b << 0); + uint32_t r, g, b, a; + r = *decoded; + decoded += bpp; + g = *decoded; + decoded += bpp; + b = *decoded; + decoded += bpp; + a = *decoded; + decoded += bpp; + data[i] = (a << 24) | (r << 16) | (g << 8) | (b << 0); } }