new function Set_image_mode() to set image mode in Load_XXX() functions
This commit is contained in:
		
							parent
							
								
									2d392fb7b1
								
							
						
					
					
						commit
						2a6f0e3a27
					
				@ -2007,11 +2007,7 @@ void Load_IFF(T_IO_Context * context)
 | 
			
		||||
          context->Background_transparent = header.Mask == 2;
 | 
			
		||||
          context->Transparent_color = context->Background_transparent ? header.Transp_col : 0;
 | 
			
		||||
 | 
			
		||||
          if (context->Type == CONTEXT_MAIN_IMAGE)
 | 
			
		||||
          {
 | 
			
		||||
            Main.backups->Pages->Image_mode = IMAGE_MODE_ANIMATION;
 | 
			
		||||
            Update_screen_targets();
 | 
			
		||||
          }
 | 
			
		||||
          Set_image_mode(context, IMAGE_MODE_ANIMATION);
 | 
			
		||||
 | 
			
		||||
          if (iff_format == FORMAT_LBM)    // "ILBM": InterLeaved BitMap
 | 
			
		||||
          {
 | 
			
		||||
@ -2752,11 +2748,7 @@ void Load_INFO(T_IO_Context * context)
 | 
			
		||||
                if (img_index == 1)
 | 
			
		||||
                {
 | 
			
		||||
                  Pre_load(context, width, height,file_size,FORMAT_INFO,PIXEL_SIMPLE, bpp);
 | 
			
		||||
                  if (context->Type == CONTEXT_MAIN_IMAGE)
 | 
			
		||||
                  {
 | 
			
		||||
                    Main.backups->Pages->Image_mode = IMAGE_MODE_ANIMATION;
 | 
			
		||||
                    Update_screen_targets();
 | 
			
		||||
                  }
 | 
			
		||||
                  Set_image_mode(context, IMAGE_MODE_ANIMATION);
 | 
			
		||||
                  has_NewIcons = 1;
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
@ -2884,11 +2876,7 @@ void Load_INFO(T_IO_Context * context)
 | 
			
		||||
        memcpy(context->Palette, amigaOS2x_pal, sizeof(amigaOS2x_pal));
 | 
			
		||||
 | 
			
		||||
      Pre_load(context, header.Width, header.Height,file_size,FORMAT_INFO,PIXEL_SIMPLE, imgheaders[0].Depth);
 | 
			
		||||
      if (context->Type == CONTEXT_MAIN_IMAGE)
 | 
			
		||||
      {
 | 
			
		||||
        Main.backups->Pages->Image_mode = IMAGE_MODE_ANIMATION;
 | 
			
		||||
        Update_screen_targets();
 | 
			
		||||
      }
 | 
			
		||||
      Set_image_mode(context, IMAGE_MODE_ANIMATION);
 | 
			
		||||
      for (img_count = 0; img_count < 2 && buffers[img_count] != NULL; img_count++)
 | 
			
		||||
      {
 | 
			
		||||
        if (img_count > 0)
 | 
			
		||||
@ -4193,11 +4181,7 @@ void Load_GIF(T_IO_Context * context)
 | 
			
		||||
                        is_looping=1;
 | 
			
		||||
                        // The well-known Netscape extension.
 | 
			
		||||
                        // Load as an animation
 | 
			
		||||
                        if (context->Type == CONTEXT_MAIN_IMAGE)
 | 
			
		||||
                        {
 | 
			
		||||
                          Main.backups->Pages->Image_mode = IMAGE_MODE_ANIMATION;
 | 
			
		||||
                          Update_screen_targets();
 | 
			
		||||
                        }
 | 
			
		||||
                        Set_image_mode(context, IMAGE_MODE_ANIMATION);
 | 
			
		||||
                        // Skip sub-block
 | 
			
		||||
                        do
 | 
			
		||||
                        {
 | 
			
		||||
 | 
			
		||||
@ -312,6 +312,15 @@ int Get_frame_duration(T_IO_Context *context)
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Set_image_mode(T_IO_Context *context, enum IMAGE_MODES mode)
 | 
			
		||||
{
 | 
			
		||||
  if (context->Type == CONTEXT_MAIN_IMAGE)
 | 
			
		||||
  {
 | 
			
		||||
    Main.backups->Pages->Image_mode = mode;
 | 
			
		||||
    Update_screen_targets();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
///
 | 
			
		||||
/// Generic allocation and similar stuff, done at beginning of image load,
 | 
			
		||||
/// as soon as size is known.
 | 
			
		||||
 | 
			
		||||
@ -230,6 +230,8 @@ void Set_saving_layer(T_IO_Context *context, int layer);
 | 
			
		||||
void Set_frame_duration(T_IO_Context *context, int duration);
 | 
			
		||||
/// Function to call to get an image's duration for saving
 | 
			
		||||
int Get_frame_duration(T_IO_Context *context);
 | 
			
		||||
/// Function to set a specific image mode
 | 
			
		||||
void Set_image_mode(T_IO_Context *context, enum IMAGE_MODES mode);
 | 
			
		||||
 | 
			
		||||
// =================================================================
 | 
			
		||||
// What follows here are the definitions of functions and data
 | 
			
		||||
 | 
			
		||||
@ -4221,7 +4221,7 @@ void Load_CM5(T_IO_Context* context)
 | 
			
		||||
 | 
			
		||||
  if (context->Type == CONTEXT_MAIN_IMAGE)
 | 
			
		||||
  {
 | 
			
		||||
    Main.backups->Pages->Image_mode = IMAGE_MODE_MODE5;
 | 
			
		||||
    Set_image_mode(context, IMAGE_MODE_MODE5);
 | 
			
		||||
 | 
			
		||||
    // Fill layer with color we just read (Layer 1 - INK 0)
 | 
			
		||||
    for(ty=0; ty<context->Height; ty++)
 | 
			
		||||
@ -4944,11 +4944,7 @@ void Load_FLI(T_IO_Context * context)
 | 
			
		||||
        if (current_frame == 0)
 | 
			
		||||
        {
 | 
			
		||||
          Pre_load(context, header.width,header.height,file_size,FORMAT_FLI,PIXEL_SIMPLE,header.depth);
 | 
			
		||||
          if (context->Type == CONTEXT_MAIN_IMAGE)
 | 
			
		||||
          {
 | 
			
		||||
            Main.backups->Pages->Image_mode = IMAGE_MODE_ANIMATION;
 | 
			
		||||
            Update_screen_targets();
 | 
			
		||||
          }
 | 
			
		||||
          Set_image_mode(context, IMAGE_MODE_ANIMATION);
 | 
			
		||||
          if (Config.Clear_palette)
 | 
			
		||||
            memset(context->Palette,0,sizeof(T_Palette));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user