From 1b410abdd66f2ef011c662fd6c52302b58cffd1c Mon Sep 17 00:00:00 2001 From: Daid Date: Sun, 5 Nov 2023 09:29:46 +0100 Subject: [PATCH] fix image 8 to 32 bit conversion --- include/sp2/graphics/image/convert.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/sp2/graphics/image/convert.h b/include/sp2/graphics/image/convert.h index 0144180..6f09f50 100644 --- a/include/sp2/graphics/image/convert.h +++ b/include/sp2/graphics/image/convert.h @@ -7,7 +7,7 @@ namespace sp::image { namespace detail { - template struct PixelConvertInfo; + template struct PixelConvertInfo; template<> struct PixelConvertInfo { static inline uint8_t conv(uint32_t in) { return ((in & 0xFF) + ((in >> 8) & 0xFF) + ((in >> 16) & 0xFF)) / 3; } }; template<> struct PixelConvertInfo { static inline uint32_t conv(uint8_t in) { return 0xFF000000 | in | (in << 8) | (in << 16); } }; } @@ -17,7 +17,7 @@ template ImageBase convert(const ImageBase auto src = input.getPtr(); auto dst = output.getPtr(); for(int n=0; n::conv(*src++); + *dst++ = detail::PixelConvertInfo::conv(*src++); return output; }