Fix minor issues

This commit is contained in:
Thomas Bernard 2018-01-17 17:31:32 +01:00
parent d9ca2e1092
commit 674fc76649
2 changed files with 14 additions and 8 deletions

View File

@ -1435,7 +1435,7 @@ static byte Bitmap_mask(dword pixel, dword mask)
return result << (8-bits_found);
}
void Load_BMP_Palette(T_IO_Context * context, FILE * file, unsigned int nb_colors, int is_rgb24)
static void Load_BMP_Palette(T_IO_Context * context, FILE * file, unsigned int nb_colors, int is_rgb24)
{
byte local_palette[256*4]; // R,G,B,0 or RGB
unsigned int i, j;
@ -1460,7 +1460,7 @@ void Load_BMP_Palette(T_IO_Context * context, FILE * file, unsigned int nb_color
}
}
void Load_BMP_Pixels(T_IO_Context * context, FILE * file, unsigned int compression, unsigned int nbbits, int top_down, const dword * mask)
static void Load_BMP_Pixels(T_IO_Context * context, FILE * file, unsigned int compression, unsigned int nbbits, int top_down, const dword * mask)
{
unsigned int row_size;
unsigned int index;
@ -1470,7 +1470,6 @@ void Load_BMP_Pixels(T_IO_Context * context, FILE * file, unsigned int compressi
byte value;
byte a,b,c=0;
printf("Load_BMP_Pixels compression=%d nbbits=%d top_down=%d\n", compression, nbbits, top_down);
switch (compression)
{
case 0 : // Pas de compression
@ -1725,8 +1724,14 @@ void Load_BMP(T_IO_Context * context)
else
nb_colors=1<<header.Nb_bits;
break;
default:
case 16:
case 24:
case 32:
true_color = 1;
break;
default:
Warning("Unsupported bit per pixel");
File_error = 1;
}
if (header.Height < 0)
@ -1752,6 +1757,7 @@ void Load_BMP(T_IO_Context * context)
mask[1] = 0x0000FF00;
mask[2] = 0x000000FF;
}
if (File_error == 0)
{
Pre_load(context, header.Width,header.Height,file_size,FORMAT_BMP,PIXEL_SIMPLE,true_color);
if (File_error==0)
@ -4492,7 +4498,7 @@ static void Load_PNG_Sub(T_IO_Context * context, FILE * file)
void Load_PNG(T_IO_Context * context)
{
FILE *file; // Fichier du fichier
FILE *file;
char filename[MAX_PATH_CHARACTERS]; // Nom complet du fichier
byte png_header[8];
@ -4509,7 +4515,7 @@ void Load_PNG(T_IO_Context * context)
if ( !png_sig_cmp(png_header, 0, 8))
Load_PNG_Sub(context, file);
else
File_error=2;
File_error=1;
}
else // Lecture header impossible: Error ne modifiant pas l'image
File_error=1;

View File

@ -162,7 +162,7 @@ void Load_SDL_Image(T_IO_Context *);
// ENUM Name TestFunc LoadFunc SaveFunc PalOnly Comment Layers Ext Exts
T_Format File_formats[] = {
{FORMAT_ALL_IMAGES, "(all)", NULL, NULL, NULL, 0, 0, 0, "", "gif;png;bmp;pcx;pkm;iff;lbm;ilbm;img;sci;scq;scf;scn;sco;pi1;pc1;cel;neo;c64;koa;koala;fli;bml;cdu;prg;tga;pnm;xpm;xcf;jpg;jpeg;tif;tiff;ico;cm5;pph"},
{FORMAT_ALL_IMAGES, "(all)", NULL, NULL, NULL, 0, 0, 0, "", "gif;png;bmp;pcx;pkm;iff;lbm;ilbm;img;sci;scq;scf;scn;sco;pi1;pc1;cel;neo;c64;koa;koala;fli;bml;cdu;prg;tga;pnm;xpm;xcf;jpg;jpeg;tif;tiff;ico;cur;cm5;pph"},
{FORMAT_ALL_PALETTES, "(all)", NULL, NULL, NULL, 1, 0, 0, "", "kcf;pal;gpl"},
{FORMAT_ALL_FILES, "(*.*)", NULL, NULL, NULL, 0, 0, 0, "", "*"},
{FORMAT_GIF, " gif", Test_GIF, Load_GIF, Save_GIF, 0, 1, 1, "gif", "gif"},
@ -189,7 +189,7 @@ T_Format File_formats[] = {
{FORMAT_PPH, " pph", Test_PPH, Load_PPH, Save_PPH, 0, 0, 1, "pph", "pph"},
{FORMAT_XPM, " xpm", NULL, NULL, Save_XPM, 0, 0, 0, "xpm", "xpm"},
{FORMAT_ICO, " ico", Test_ICO, Load_ICO, NULL, 0, 0, 0, "ico", "ico;cur"},
{FORMAT_MISC,"misc.",NULL, NULL, NULL, 0, 0, 0, "", "tga;pnm;xpm;xcf;jpg;jpeg;tif;tiff;ico"},
{FORMAT_MISC,"misc.",NULL, NULL, NULL, 0, 0, 0, "", "tga;pnm;xpm;xcf;jpg;jpeg;tif;tiff"},
};
/// Total number of known file formats