Now save all color ranges, not only the cycling ones. Only solid ranges (1 color) are discarded. Also fixed a few harmless compilation warnings
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1619 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
		
							parent
							
								
									29b1acc63f
								
							
						
					
					
						commit
						82e469a11e
					
				@ -1698,7 +1698,7 @@ void Close_window(void)
 | 
			
		||||
//---------------- Dessiner un bouton normal dans une fenêtre ----------------
 | 
			
		||||
 | 
			
		||||
void Window_draw_normal_bouton(word x_pos,word y_pos,word width,word height,
 | 
			
		||||
                                    char * title,byte undersc_letter,byte clickable)
 | 
			
		||||
                                    const char * title,byte undersc_letter,byte clickable)
 | 
			
		||||
{
 | 
			
		||||
  byte title_color;
 | 
			
		||||
  word text_x_pos,text_y_pos;
 | 
			
		||||
@ -1953,7 +1953,7 @@ void Window_clear_input_button(T_Special_button * button)
 | 
			
		||||
 | 
			
		||||
T_Normal_button * Window_set_normal_button(word x_pos, word y_pos,
 | 
			
		||||
                                   word width, word height,
 | 
			
		||||
                                   char * title, byte undersc_letter,
 | 
			
		||||
                                   const char * title, byte undersc_letter,
 | 
			
		||||
                                   byte clickable, word shortcut)
 | 
			
		||||
{
 | 
			
		||||
  T_Normal_button * temp=NULL;
 | 
			
		||||
@ -1983,7 +1983,7 @@ T_Normal_button * Window_set_normal_button(word x_pos, word y_pos,
 | 
			
		||||
 | 
			
		||||
T_Normal_button * Window_set_repeatable_button(word x_pos, word y_pos,
 | 
			
		||||
                                   word width, word height,
 | 
			
		||||
                                   char * title, byte undersc_letter,
 | 
			
		||||
                                   const char * title, byte undersc_letter,
 | 
			
		||||
                                   byte clickable, word shortcut)
 | 
			
		||||
{
 | 
			
		||||
  T_Normal_button * temp=NULL;
 | 
			
		||||
 | 
			
		||||
@ -40,7 +40,7 @@ void Open_popup            (word x_pos, word y_pos, word width, word height);
 | 
			
		||||
void Close_popup           (void);
 | 
			
		||||
 | 
			
		||||
void Window_draw_normal_bouton(word x_pos,word y_pos,word width,word height,
 | 
			
		||||
  char * title,byte undersc_letter,byte clickable);
 | 
			
		||||
  const char * title,byte undersc_letter,byte clickable);
 | 
			
		||||
void Window_select_normal_button(word x_pos,word y_pos,word width,word height);
 | 
			
		||||
void Window_unselect_normal_button(word x_pos,word y_pos,word width,word height);
 | 
			
		||||
void Window_draw_palette_bouton(word x_pos,word y_pos);
 | 
			
		||||
@ -54,11 +54,11 @@ void Window_clear_input_button(T_Special_button * button);
 | 
			
		||||
void Window_draw_input_bouton(word x_pos, word y_pos, word width_in_characters);
 | 
			
		||||
 | 
			
		||||
T_Normal_button * Window_set_normal_button(word x_pos, word y_pos,
 | 
			
		||||
  word width, word height, char * title, byte undersc_letter,
 | 
			
		||||
  word width, word height, const char * title, byte undersc_letter,
 | 
			
		||||
  byte clickable, word shortcut);
 | 
			
		||||
 | 
			
		||||
T_Normal_button * Window_set_repeatable_button(word x_pos, word y_pos,
 | 
			
		||||
  word width, word height, char * title, byte undersc_letter,
 | 
			
		||||
  word width, word height, const char * title, byte undersc_letter,
 | 
			
		||||
  byte clickable, word shortcut);
 | 
			
		||||
 | 
			
		||||
T_Palette_button * Window_set_palette_button(word x_pos, word y_pos);
 | 
			
		||||
 | 
			
		||||
@ -660,7 +660,7 @@ void Load_LBM(T_IO_Context * context)
 | 
			
		||||
                  && (Read_byte(LBM_file,&min_col))
 | 
			
		||||
                  && (Read_byte(LBM_file,&max_col)))
 | 
			
		||||
                {
 | 
			
		||||
                  if (section_size == 8 && (flags & 1) && min_col != max_col)
 | 
			
		||||
                  if (section_size == 8 && min_col != max_col)
 | 
			
		||||
                  {
 | 
			
		||||
                    // Valid cycling range
 | 
			
		||||
                    if (max_col<min_col)
 | 
			
		||||
@ -669,7 +669,7 @@ void Load_LBM(T_IO_Context * context)
 | 
			
		||||
                    context->Cycle_range[context->Color_cycles].Start=min_col;
 | 
			
		||||
                    context->Cycle_range[context->Color_cycles].End=max_col;
 | 
			
		||||
                    context->Cycle_range[context->Color_cycles].Inverse=(flags&2)?1:0;
 | 
			
		||||
                    context->Cycle_range[context->Color_cycles].Speed=rate/78;
 | 
			
		||||
                    context->Cycle_range[context->Color_cycles].Speed=(flags&1) ? rate/78 : 0;
 | 
			
		||||
                                        
 | 
			
		||||
                    context->Color_cycles++;
 | 
			
		||||
                  }
 | 
			
		||||
@ -1015,11 +1015,15 @@ void Save_LBM(T_IO_Context * context)
 | 
			
		||||
    
 | 
			
		||||
    for (i=0; i<context->Color_cycles; i++)
 | 
			
		||||
    {
 | 
			
		||||
      word flags=0;
 | 
			
		||||
      flags|= context->Cycle_range[i].Speed?1:0; // Cycling or not
 | 
			
		||||
      flags|= context->Cycle_range[i].Inverse?2:0; // Inverted
 | 
			
		||||
              
 | 
			
		||||
      Write_bytes(LBM_file,"CRNG",4);
 | 
			
		||||
      Write_dword_be(LBM_file,8); // Section size
 | 
			
		||||
      Write_word_be(LBM_file,0); // Padding
 | 
			
		||||
      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_word_be(LBM_file,flags); // Flags
 | 
			
		||||
      Write_byte(LBM_file,context->Cycle_range[i].Start); // Min color
 | 
			
		||||
      Write_byte(LBM_file,context->Cycle_range[i].End); // Max color
 | 
			
		||||
      // No padding, size is multiple of 2
 | 
			
		||||
@ -2027,7 +2031,7 @@ void Load_GIF(T_IO_Context * context)
 | 
			
		||||
                            && (Read_byte(GIF_file,&min_col))
 | 
			
		||||
                            && (Read_byte(GIF_file,&max_col)))
 | 
			
		||||
                          {
 | 
			
		||||
                            if ((flags & 1) && min_col != max_col)
 | 
			
		||||
                            if (min_col != max_col)
 | 
			
		||||
                            {
 | 
			
		||||
                              // Valid cycling range
 | 
			
		||||
                              if (max_col<min_col)
 | 
			
		||||
@ -2036,7 +2040,7 @@ void Load_GIF(T_IO_Context * context)
 | 
			
		||||
                              context->Cycle_range[context->Color_cycles].Start=min_col;
 | 
			
		||||
                              context->Cycle_range[context->Color_cycles].End=max_col;
 | 
			
		||||
                              context->Cycle_range[context->Color_cycles].Inverse=(flags&2)?1:0;
 | 
			
		||||
                              context->Cycle_range[context->Color_cycles].Speed=rate/78;
 | 
			
		||||
                              context->Cycle_range[context->Color_cycles].Speed=(flags&1)?rate/78:0;
 | 
			
		||||
                                                  
 | 
			
		||||
                              context->Color_cycles++;
 | 
			
		||||
                            }
 | 
			
		||||
@ -2414,8 +2418,12 @@ void Save_GIF(T_IO_Context * context)
 | 
			
		||||
            Write_byte(GIF_file,context->Color_cycles*6);
 | 
			
		||||
            for (i=0; i<context->Color_cycles; i++)
 | 
			
		||||
            {
 | 
			
		||||
              word flags=0;
 | 
			
		||||
              flags|= context->Cycle_range[i].Speed?1:0; // Cycling or not
 | 
			
		||||
              flags|= context->Cycle_range[i].Inverse?2:0; // Inverted
 | 
			
		||||
              
 | 
			
		||||
              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_word_be(GIF_file,flags); // Flags
 | 
			
		||||
              Write_byte(GIF_file,context->Cycle_range[i].Start); // Min color
 | 
			
		||||
              Write_byte(GIF_file,context->Cycle_range[i].End); // Max color
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -1158,7 +1158,7 @@ void Init_context_layered_image(T_IO_Context * context, char *file_name, char *f
 | 
			
		||||
  // Color cyling ranges:
 | 
			
		||||
  for (i=0; i<16; i++)
 | 
			
		||||
  {
 | 
			
		||||
    if (Main_backups->Pages->Gradients->Range[i].Start!=Main_backups->Pages->Gradients->Range[i].End && Main_backups->Pages->Gradients->Range[i].Speed)
 | 
			
		||||
    if (Main_backups->Pages->Gradients->Range[i].Start!=Main_backups->Pages->Gradients->Range[i].End)
 | 
			
		||||
    {
 | 
			
		||||
      context->Cycle_range[context->Color_cycles].Start=Main_backups->Pages->Gradients->Range[i].Start;
 | 
			
		||||
      context->Cycle_range[context->Color_cycles].End=Main_backups->Pages->Gradients->Range[i].End;
 | 
			
		||||
 | 
			
		||||
@ -901,7 +901,7 @@ int Backup_with_new_dimensions(int width,int height)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
///
 | 
			
		||||
/// Resizes a backup step in-place.
 | 
			
		||||
/// Resizes a backup step in-place (doesn't add a Undo/Redo step).
 | 
			
		||||
/// Should only be called after an actual backup, because it loses the current.
 | 
			
		||||
/// pixels. This function is meant to be used from within Lua scripts.
 | 
			
		||||
int Backup_in_place(int width,int height)
 | 
			
		||||
 | 
			
		||||
@ -93,7 +93,13 @@ void Free_page_of_a_list(T_List_of_pages * list);
 | 
			
		||||
 | 
			
		||||
int Init_all_backup_lists(int width,int height);
 | 
			
		||||
void Set_number_of_backups(int nb_backups);
 | 
			
		||||
int Backup_new_image(byte layers,int width,int height);
 | 
			
		||||
int Backup_with_new_dimensions(int width,int height);
 | 
			
		||||
///
 | 
			
		||||
/// Resizes a backup step in-place (doesn't add a Undo/Redo step).
 | 
			
		||||
/// Should only be called after an actual backup, because it loses the current.
 | 
			
		||||
/// pixels. This function is meant to be used from within Lua scripts.
 | 
			
		||||
int Backup_in_place(int width,int height);
 | 
			
		||||
/// Backup the spare image, the one you don't see.
 | 
			
		||||
void Backup_the_spare(dword layer_mask);
 | 
			
		||||
int Backup_and_resize_the_spare(int width,int height);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user