From 1dce247656d6439359783d12557583b233987c94 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 2 Feb 2013 08:38:08 +0000 Subject: [PATCH] Improve XOR table computation. Set the initial state to XOR[i]=i, so that on very low color images, the algorithm will try to swap around the first colors. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@2049 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- src/palette.c | 1 - src/windows.c | 12 +----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/palette.c b/src/palette.c index 185fca81..6c184ecf 100644 --- a/src/palette.c +++ b/src/palette.c @@ -841,7 +841,6 @@ void Draw_all_palette_sliders(T_Scroller_button * red_slider, { RGB_to_HSL(j1,j2,j3,&j1,&j2,&j3); } - DEBUG("j1",j1); Format_component(j1*Color_count/256,str); red_slider->Position=Color_max-Expand_component(j1); Window_draw_slider(red_slider); diff --git a/src/windows.c b/src/windows.c index 42bc54c3..08a5e80f 100644 --- a/src/windows.c +++ b/src/windows.c @@ -2972,22 +2972,12 @@ static void compute_xor_table() // Initialize the table with some "random" values for(i = 0; i < 256; i++) { - xor_lut[i] = 255 - i; + xor_lut[i] = i; } do { // Find the smallest difference in the table - //int mindiff = INT_MAX; int idx; - /* - for(i = 0; i < 256; i++) - { - int diff = Diff(i, xor_lut[i]); - if (diff < mindiff) { - idx = i; - mindiff = diff; - } - }*/ // Try to pair these two colors better found = 0;