Fix issue 323: X-Invert didn't remap (it worked fine in 2.1). In Palette screen, fix Color reduce that only checked for used colors in visible image (instead of all layers)

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1368 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2010-03-01 22:49:55 +00:00
parent 46f235f743
commit e423b5fb92
2 changed files with 17 additions and 11 deletions

20
misc.c
View File

@ -46,25 +46,31 @@
word Count_used_colors(dword* usage) word Count_used_colors(dword* usage)
{ {
int nb_pixels = 0; int nb_pixels = 0;
Uint8* current_pixel = Main_screen; Uint8* current_pixel;
Uint8 color; Uint8 color;
word nb_colors = 0; word nb_colors = 0;
int i; int i;
int layer;
for (i = 0; i < 256; i++) usage[i]=0; for (i = 0; i < 256; i++) usage[i]=0;
// Compute total number of pixels in the picture // Compute total number of pixels in the picture
nb_pixels = Main_image_height * Main_image_width; nb_pixels = Main_image_height * Main_image_width;
// For each pixel in picture // For each layer
for (i = 0; i < nb_pixels; i++) for (layer = 0; layer < Main_backups->Pages->Nb_layers; layer++)
{ {
color=*current_pixel; // get color in picture for this pixel current_pixel = Main_backups->Pages->Image[layer];
// For each pixel in picture
for (i = 0; i < nb_pixels; i++)
{
color=*current_pixel; // get color in picture for this pixel
usage[color]++; // add it to the counter usage[color]++; // add it to the counter
// go to next pixel // go to next pixel
current_pixel++; current_pixel++;
}
} }
// count the total number of unique used colors // count the total number of unique used colors

View File

@ -1838,7 +1838,7 @@ void Button_Palette(void)
Set_red(i,backup_palette[temp_color].R,working_palette); Set_red(i,backup_palette[temp_color].R,working_palette);
Set_green (i,backup_palette[temp_color].G,working_palette); Set_green (i,backup_palette[temp_color].G,working_palette);
Set_blue (i,backup_palette[temp_color].B,working_palette); Set_blue (i,backup_palette[temp_color].B,working_palette);
if (clicked_button==22) if (clicked_button==21)
{ {
conversion_table[i]=temp_color; conversion_table[i]=temp_color;
conversion_table[temp_color]=i; conversion_table[temp_color]=i;
@ -1850,7 +1850,7 @@ void Button_Palette(void)
} }
Draw_all_palette_sliders(red_slider,green_slider,blue_slider,working_palette,block_start,block_end); Draw_all_palette_sliders(red_slider,green_slider,blue_slider,working_palette,block_start,block_end);
// Si on est en X-Invert, on remap l'image (=> on fait aussi 1 backup) // Si on est en X-Invert, on remap l'image (=> on fait aussi 1 backup)
if (clicked_button==22) if (clicked_button==21)
{ {
if (!image_is_backed_up) if (!image_is_backed_up)
{ {