Fix horrible crash with GIF-saving
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1601 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
962d23dbc4
commit
9f47e427c7
@ -2414,10 +2414,10 @@ void Save_GIF(T_IO_Context * context)
|
||||
Write_byte(GIF_file,context->Color_cycles*6);
|
||||
for (i=0; i<context->Color_cycles; i++)
|
||||
{
|
||||
Write_word_be(LBM_file,context->Cycle_range[i].Speed*78); // Rate
|
||||
Write_word_be(LBM_file,1|(context->Cycle_range[i].Inverse?2:0)); // Flags
|
||||
Write_byte(LBM_file,context->Cycle_range[i].Start); // Min color
|
||||
Write_byte(LBM_file,context->Cycle_range[i].End); // Max color
|
||||
Write_word_be(GIF_file,context->Cycle_range[i].Speed*78); // Rate
|
||||
Write_word_be(GIF_file,1|(context->Cycle_range[i].Inverse?2:0)); // Flags
|
||||
Write_byte(GIF_file,context->Cycle_range[i].Start); // Min color
|
||||
Write_byte(GIF_file,context->Cycle_range[i].End); // Max color
|
||||
}
|
||||
Write_byte(GIF_file,0);
|
||||
}
|
||||
|
||||
@ -227,8 +227,6 @@ void Palette_loaded(T_IO_Context *context)
|
||||
switch (context->Type)
|
||||
{
|
||||
case CONTEXT_MAIN_IMAGE:
|
||||
Set_palette(context->Palette);
|
||||
break;
|
||||
case CONTEXT_PREVIEW:
|
||||
case CONTEXT_BRUSH:
|
||||
case CONTEXT_SURFACE:
|
||||
@ -665,11 +663,34 @@ void Load_image(T_IO_Context *context)
|
||||
free(context->Buffer_image_24b);
|
||||
context->Buffer_image_24b = NULL;
|
||||
}
|
||||
else if (context->Type == CONTEXT_MAIN_IMAGE)
|
||||
{
|
||||
// Non-24b main image: Add menu colors
|
||||
if (Config.Safety_colors)
|
||||
{
|
||||
dword color_usage[256];
|
||||
memset(color_usage,0,sizeof(color_usage));
|
||||
if (Count_used_colors(color_usage)<252)
|
||||
{
|
||||
int gui_index=0;
|
||||
int c;
|
||||
for (c=255; c>=0 && gui_index<4; c--)
|
||||
{
|
||||
if (color_usage[c]==0)
|
||||
{
|
||||
context->Palette[c]=*Favorite_GUI_color(gui_index);
|
||||
gui_index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (context->Type == CONTEXT_MAIN_IMAGE)
|
||||
{
|
||||
if ( File_error!=1)
|
||||
{
|
||||
Set_palette(context->Palette);
|
||||
if (format->Palette_only)
|
||||
{
|
||||
// Make a backup step
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user