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:
24
misc.c
24
misc.c
@@ -46,25 +46,31 @@
|
||||
word Count_used_colors(dword* usage)
|
||||
{
|
||||
int nb_pixels = 0;
|
||||
Uint8* current_pixel = Main_screen;
|
||||
Uint8* current_pixel;
|
||||
Uint8 color;
|
||||
word nb_colors = 0;
|
||||
int i;
|
||||
int layer;
|
||||
|
||||
for (i = 0; i < 256; i++) usage[i]=0;
|
||||
|
||||
// Compute total number of pixels in the picture
|
||||
nb_pixels = Main_image_height * Main_image_width;
|
||||
|
||||
// For each pixel in picture
|
||||
for (i = 0; i < nb_pixels; i++)
|
||||
// For each layer
|
||||
for (layer = 0; layer < Main_backups->Pages->Nb_layers; layer++)
|
||||
{
|
||||
color=*current_pixel; // get color in picture for this pixel
|
||||
|
||||
usage[color]++; // add it to the counter
|
||||
|
||||
// go to next pixel
|
||||
current_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
|
||||
|
||||
// go to next pixel
|
||||
current_pixel++;
|
||||
}
|
||||
}
|
||||
|
||||
// count the total number of unique used colors
|
||||
|
||||
Reference in New Issue
Block a user