From c821dbebf4f73ef7956f742845081e7b19c23a90 Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Sat, 15 Feb 2014 17:34:43 +0000 Subject: [PATCH] Modify the RGB scale formula git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@2070 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- src/palette.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/palette.c b/src/palette.c index 6c184ecf..3d503488 100644 --- a/src/palette.c +++ b/src/palette.c @@ -77,7 +77,7 @@ int Get_palette_RGB_scale(void) /// The result is also in the 0-255 range. byte Round_palette_component(byte comp) { - return ((comp+128/RGB_scale)*(RGB_scale-1)/255*255+(RGB_scale&1?1:0))/(RGB_scale-1); + return (comp*RGB_scale/256+(RGB_scale-(256-1)*RGB_scale/256)/2) * (255/(RGB_scale-1)); } ///