Eliminated a lot of tab characters in source code

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1342 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2010-02-13 19:25:49 +00:00
parent 480c9abaab
commit 7076e8e06d
17 changed files with 845 additions and 845 deletions

View File

@ -33,21 +33,21 @@ void Stencil_update_color(byte color);
void Stencil_tag_color(byte color, byte tag_color);
/*!
Displays an error message when there is no more memory for the requested
operation.
Displays an error message when there is no more memory for the requested
operation.
*/
void Message_out_of_memory(void);
/*!
Displays the splash screen at program startup.
Displays the splash screen at program startup.
*/
void Button_Message_initial(void);
/*!
Changes brush shape.
This function saves the current brush shape and swith to the default one
(single pixel brush) for the filler and the color picker.
These functions don't need (and will not work with) a custom brush.
Changes brush shape.
This function saves the current brush shape and swith to the default one
(single pixel brush) for the filler and the color picker.
These functions don't need (and will not work with) a custom brush.
*/
void Change_paintbrush_shape(byte shape);
@ -587,7 +587,7 @@ void Button_Autosave(void);
void Button_Settings(void);
/*!
Display the skin selector window.
Display the skin selector window.
*/
void Button_Skins(void);

View File

@ -258,9 +258,9 @@ void Button_Grid_menu(void)
Window_set_normal_button(12, 62, 14, 14, " ", 0, 1, 0); // 7
Window_set_normal_button(70, 62, 14, 14, " ", 0, 1, 0); // 8
if (snapgrid)
Print_in_window(16, 65, "X", MC_Black, MC_Light);
Print_in_window(16, 65, "X", MC_Black, MC_Light);
if (Show_grid)
Print_in_window(74, 65, "X", MC_Black, MC_Light);
Print_in_window(74, 65, "X", MC_Black, MC_Light);
Print_in_window(32, 65,"Snap",MC_Dark,MC_Light);
Print_in_window(90, 65,"Show",MC_Dark,MC_Light);
@ -349,18 +349,18 @@ void Button_Grid_menu(void)
Display_cursor();
case 7:
snapgrid = !snapgrid;
Hide_cursor();
Print_in_window(16, 65, snapgrid?"X":" ", MC_Black, MC_Light);
Display_cursor();
break;
case 8:
showgrid = !showgrid;
Hide_cursor();
Print_in_window(74, 65, showgrid?"X":" ", MC_Black, MC_Light);
Display_cursor();
break;
case 7:
snapgrid = !snapgrid;
Hide_cursor();
Print_in_window(16, 65, snapgrid?"X":" ", MC_Black, MC_Light);
Display_cursor();
break;
case 8:
showgrid = !showgrid;
Hide_cursor();
Print_in_window(74, 65, showgrid?"X":" ", MC_Black, MC_Light);
Display_cursor();
break;
}
if (Is_shortcut(Key,0x100+BUTTON_HELP))
@ -375,7 +375,7 @@ void Button_Grid_menu(void)
Snap_offset_X=dx_selected;
Snap_offset_Y=dy_selected;
Snap_mode=snapgrid;
Show_grid=showgrid;
Show_grid=showgrid;
}
Close_window();

16
const.h
View File

@ -149,14 +149,14 @@ enum ERROR_CODES
enum PIXEL_RATIO
{
PIXEL_SIMPLE=0, ///< Use real pixels
PIXEL_WIDE, ///< Use wide pixels (2x1) like on Amstrad CPC mode 0
PIXEL_TALL, ///< Use tall pixels (1x2) like on Amstrad CPC mode 2
PIXEL_DOUBLE, ///< Use big pixels (2x2) if your LCD screen can't do lowres by itself
PIXEL_TRIPLE, ///< Use really big pixels (3x3)
PIXEL_WIDE2, ///< Use big wide pixels (4x2)
PIXEL_TALL2, ///< Use big tall pixels (2x4)
PIXEL_QUAD, ///< Use really giant pixels (4x4). You need to have a screen resolution at least 1280x800 to use this one
PIXEL_MAX ///< Number of elements in enum
PIXEL_WIDE, ///< Use wide pixels (2x1) like on Amstrad CPC mode 0
PIXEL_TALL, ///< Use tall pixels (1x2) like on Amstrad CPC mode 2
PIXEL_DOUBLE, ///< Use big pixels (2x2) if your LCD screen can't do lowres by itself
PIXEL_TRIPLE, ///< Use really big pixels (3x3)
PIXEL_WIDE2, ///< Use big wide pixels (4x2)
PIXEL_TALL2, ///< Use big tall pixels (2x4)
PIXEL_QUAD, ///< Use really giant pixels (4x4). You need to have a screen resolution at least 1280x800 to use this one
PIXEL_MAX ///< Number of elements in enum
};
/// Different kinds of menu button behavior.

View File

@ -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);
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,35 +54,35 @@ 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,
byte clickable, word shortcut);
word width, word height, 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,
byte clickable, word shortcut);
word width, word height, char * title, byte undersc_letter,
byte clickable, word shortcut);
T_Palette_button * Window_set_palette_button(word x_pos, word y_pos);
void Window_clear_tags(void);
void Tag_color_range(byte start, byte end);
T_Scroller_button * Window_set_scroller_button(word x_pos, word y_pos,
word height, word nb_elements, word nb_elements_visible,
word initial_position);
word height, word nb_elements, word nb_elements_visible,
word initial_position);
T_Special_button * Window_set_special_button(word x_pos, word y_pos, word width,
word height);
word height);
T_Special_button * Window_set_input_button(word x_pos, word y_pos,
word width_in_characters);
word width_in_characters);
T_Dropdown_button * Window_set_dropdown_button(word x_pos, word y_pos,
word width, word height, word dropdown_width, const char *label,
byte display_choice, byte display_centered, byte display_arrow,
byte active_button,byte bottom_up);
word width, word height, word dropdown_width, const char *label,
byte display_choice, byte display_centered, byte display_arrow,
byte active_button,byte bottom_up);
/// Adds an item to a dropdown menu
void Window_dropdown_add_item(T_Dropdown_button * dropdown, word btn_number,
const char *label);
const char *label);
void Window_dropdown_clear_items(T_Dropdown_button * dropdown);
@ -94,10 +94,10 @@ void Window_dropdown_clear_items(T_Dropdown_button * dropdown);
T_Dropdown_choice * Dropdown_activate(T_Dropdown_button *button, short off_x, short off_y);
T_List_button * Window_set_list_button(T_Special_button * entry_button,
T_Scroller_button * scroller, Func_draw_list_item draw_list_item);
T_Scroller_button * scroller, Func_draw_list_item draw_list_item);
void Window_redraw_list(T_List_button * list);
byte Window_click_in_rectangle(short start_x, short start_y, short end_x,
short end_y);
short end_y);
short Wait_click_in_palette(T_Palette_button * button);
void Get_color_behind_window(byte * color, byte * click);

View File

@ -1404,8 +1404,8 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
else Selected_type = 0;
}
// Now load immediately, but only if the user exited readline by pressing ENTER
if (Mouse_K == 0) has_clicked_ok = 1;
// Now load immediately, but only if the user exited readline by pressing ENTER
if (Mouse_K == 0) has_clicked_ok = 1;
}
else
{
@ -1647,7 +1647,7 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
Display_cursor();
New_preview_is_needed=1;
// On est dans un nouveau répertoire, donc on remet le quicksearch à 0
// On est dans un nouveau répertoire, donc on remet le quicksearch à 0
*quicksearch_filename=0;
}
else // Sinon on essaye de charger ou sauver le fichier

14
init.c
View File

@ -353,9 +353,9 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
// Preview
cursor_x += Menu_bars[MENUBAR_TOOLS].Skin_width;
if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "preview"))
return 1;
return 1;
if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Preview, 173, 16, "logo", 0))
return 1;
return 1;
cursor_y+= Menu_bars[MENUBAR_TOOLS].Height;
// Layerbar
@ -1936,10 +1936,10 @@ void Set_all_video_modes(void)
{
int index2;
#if defined(__GP2X__)
// On the GP2X the first mode is not windowed, so include it in the search.
index2=0;
// On the GP2X the first mode is not windowed, so include it in the search.
index2=0;
#else
index2=1;
index2=1;
#endif
for (/**/; index2 < Nb_video_modes; index2++)
if (Modes[index]->w == Video_mode[index2].Width &&
@ -2084,9 +2084,9 @@ int Load_CFG(int reload_all)
goto Erreur_lecture_config;
#if defined(__GP2X__)
index2=0;
index2=0;
#else
index2=1;
index2=1;
#endif
for (/**/; index2<Nb_video_modes; index2++)
{

18
input.c
View File

@ -490,7 +490,7 @@ int Handle_joystick_press(SDL_JoyButtonEvent event)
Directional_up_left=1;
break;
default:
break;
break;
}
#endif
Key = (KEY_JOYBUTTON+event.button)|Key_modifiers(SDL_GetModState());
@ -517,15 +517,15 @@ int Handle_joystick_release(SDL_JoyButtonEvent event)
return Release_control(0,MOD_ALT);
}
if (event.button == Joybutton_left_click)
{
Input_new_mouse_K &= ~1;
return Move_cursor_with_constraints();
}
{
Input_new_mouse_K &= ~1;
return Move_cursor_with_constraints();
}
if (event.button == Joybutton_right_click)
{
Input_new_mouse_K &= ~2;
return Move_cursor_with_constraints();
}
{
Input_new_mouse_K &= ~2;
return Move_cursor_with_constraints();
}
#ifdef __GP2X__
switch(event.button)

View File

@ -136,13 +136,13 @@ unsigned char *raw2crtc(T_IO_Context *context, unsigned short width, unsigned sh
{
for(hcc = 0; hcc < *r1; hcc++)
{
for(cclk = 0; cclk < 2; cclk++)
{
x = (hcc << 1 | cclk);
y = vcc*(r9+1) + rcc;
*(tmpBuffer + addrCalc(vcc, rcc, hcc, cclk, *r1, r12, r13)) = (*ptrMode)(context,x,y);
*(allocationBuffer + addrCalc(vcc, rcc, hcc, cclk, *r1, r12, r13)) += 1;
}
for(cclk = 0; cclk < 2; cclk++)
{
x = (hcc << 1 | cclk);
y = vcc*(r9+1) + rcc;
*(tmpBuffer + addrCalc(vcc, rcc, hcc, cclk, *r1, r12, r13)) = (*ptrMode)(context,x,y);
*(allocationBuffer + addrCalc(vcc, rcc, hcc, cclk, *r1, r12, r13)) += 1;
}
}
}
}

16
main.c
View File

@ -782,19 +782,19 @@ int Init_program(int argc,char * argv[])
case 2:
// Load this file
Init_context_layered_image(&context, spare_filename, spare_directory);
Load_image(&context);
Destroy_context(&context);
End_of_modification();
Init_context_layered_image(&context, spare_filename, spare_directory);
Load_image(&context);
Destroy_context(&context);
End_of_modification();
Redraw_layered_image();
Button_Page();
// no break ! proceed with the other file now
case 1:
Init_context_layered_image(&context, main_filename, main_directory);
Load_image(&context);
Destroy_context(&context);
End_of_modification();
Init_context_layered_image(&context, main_filename, main_directory);
Load_image(&context);
Destroy_context(&context);
End_of_modification();
Redraw_layered_image();
Hide_cursor();

952
misc.c

File diff suppressed because it is too large Load Diff

View File

@ -2577,86 +2577,86 @@ void Save_C64(T_IO_Context * context)
void Test_SCR(__attribute__((unused)) T_IO_Context * context)
{
// Mmh... not sure what we could test. Any idea ?
// The palette file can be tested, if it exists and have the right size it's
// ok. But if it's not there the pixel data may still be valid. And we can't
// use the filesize as this depends on the screen format.
// An AMSDOS header would be a good indication but in some cases it may not
// be there
// Mmh... not sure what we could test. Any idea ?
// The palette file can be tested, if it exists and have the right size it's
// ok. But if it's not there the pixel data may still be valid. And we can't
// use the filesize as this depends on the screen format.
// An AMSDOS header would be a good indication but in some cases it may not
// be there
}
void Load_SCR(__attribute__((unused)) T_IO_Context * context)
{
// The Amstrad CPC screen memory is mapped in a weird mode, somewhere
// between bitmap and textmode. Basically the only way to decode this is to
// emulate the video chip and read the bytes as needed...
// Moreover, the hardware allows the screen to have any size from 8x1 to
// 800x273 pixels, and there is no indication of that in the file besides
// its size. It can also use any of the 3 screen modes. Fortunately this
// last bit of information is stored in the palette file.
// Oh, and BTW, the picture can be offset, and it's even usual to do it,
// because letting 128 pixels unused at the beginning of the file make it a
// lot easier to handle screens using more than 16K of VRam.
// The pixel encoding change with the video mode so we have to know that
// before attempting to load anything...
// As if this wasn't enough, Advanced OCP Art Studio, the reference tool on
// Amstrad, can use RLE packing when saving files, meaning we also have to
// handle that.
// All this mess enforces us to load (and unpack if needed) the file to a
// temporary 32k buffer before actually decoding it.
// 1) Seek for a palette
// 2) If palette found get screenmode from there, else ask user
// 3) ask user for screen size (or register values)
// 4) Load color data from palette (if found)
// 5) Close palette
// 6) Open the file
// 7) Run around the screen to untangle the pixeldata
// 8) Close the file
// The Amstrad CPC screen memory is mapped in a weird mode, somewhere
// between bitmap and textmode. Basically the only way to decode this is to
// emulate the video chip and read the bytes as needed...
// Moreover, the hardware allows the screen to have any size from 8x1 to
// 800x273 pixels, and there is no indication of that in the file besides
// its size. It can also use any of the 3 screen modes. Fortunately this
// last bit of information is stored in the palette file.
// Oh, and BTW, the picture can be offset, and it's even usual to do it,
// because letting 128 pixels unused at the beginning of the file make it a
// lot easier to handle screens using more than 16K of VRam.
// The pixel encoding change with the video mode so we have to know that
// before attempting to load anything...
// As if this wasn't enough, Advanced OCP Art Studio, the reference tool on
// Amstrad, can use RLE packing when saving files, meaning we also have to
// handle that.
// All this mess enforces us to load (and unpack if needed) the file to a
// temporary 32k buffer before actually decoding it.
// 1) Seek for a palette
// 2) If palette found get screenmode from there, else ask user
// 3) ask user for screen size (or register values)
// 4) Load color data from palette (if found)
// 5) Close palette
// 6) Open the file
// 7) Run around the screen to untangle the pixeldata
// 8) Close the file
}
void Save_SCR(T_IO_Context * context)
{
// TODO : Add possibility to set R9, R12, R13 values
// TODO : Add OCP packing support
// TODO : Add possibility to include AMSDOS header, with proper loading
// address guessed from r12/r13 values.
unsigned char* output;
unsigned long outsize;
unsigned char r1;
int cpc_mode;
FILE* file;
char filename[MAX_PATH_CHARACTERS];
// TODO : Add possibility to set R9, R12, R13 values
// TODO : Add OCP packing support
// TODO : Add possibility to include AMSDOS header, with proper loading
// address guessed from r12/r13 values.
unsigned char* output;
unsigned long outsize;
unsigned char r1;
int cpc_mode;
FILE* file;
char filename[MAX_PATH_CHARACTERS];
Get_full_filename(filename, context->File_name, context->File_directory);
Get_full_filename(filename, context->File_name, context->File_directory);
switch(Pixel_ratio)
{
case PIXEL_WIDE:
case PIXEL_WIDE2:
cpc_mode = 0;
break;
case PIXEL_TALL:
case PIXEL_TALL2:
cpc_mode = 2;
break;
default:
cpc_mode = 1;
break;
}
switch(Pixel_ratio)
{
case PIXEL_WIDE:
case PIXEL_WIDE2:
cpc_mode = 0;
break;
case PIXEL_TALL:
case PIXEL_TALL2:
cpc_mode = 2;
break;
default:
cpc_mode = 1;
break;
}
output = raw2crtc(context->Width,context->Height,cpc_mode,7,&outsize,&r1,0,0);
output = raw2crtc(context->Width,context->Height,cpc_mode,7,&outsize,&r1,0,0);
file = fopen(filename,"wb");
Write_bytes(file, output, outsize);
fclose(file);
file = fopen(filename,"wb");
Write_bytes(file, output, outsize);
fclose(file);
free (output);
free (output);
output = NULL;
File_error = 0;
File_error = 0;
}

278
op_c.c
View File

@ -187,18 +187,18 @@ T_Conversion_table * CT_new(int nbb_r,int nbb_g,int nbb_b)
n->nbb_b=nbb_b;
// Calculate the others
// Value ranges (max value actually)
// Value ranges (max value actually)
n->rng_r=(1<<nbb_r);
n->rng_g=(1<<nbb_g);
n->rng_b=(1<<nbb_b);
// Shifts
// Shifts
n->dec_r=nbb_g+nbb_b;
n->dec_g=nbb_b;
n->dec_b=0;
// Reductions (how many bits are lost)
// Reductions (how many bits are lost)
n->red_r=8-nbb_r;
n->red_g=8-nbb_g;
n->red_b=8-nbb_b;
@ -550,7 +550,7 @@ ENDCRUSH:
/// Split a cluster on its longest axis.
/// c = source cluster, c1, c2 = output after split
void Cluster_split(T_Cluster * c, T_Cluster * c1, T_Cluster * c2, int hue,
T_Occurrence_table * to)
T_Occurrence_table * to)
{
int limit;
int cumul;
@ -561,7 +561,7 @@ void Cluster_split(T_Cluster * c, T_Cluster * c1, T_Cluster * c2, int hue,
cumul = 0;
if (hue == 0) // split on red
{
// Run over the cluster until we reach the requested number of pixels
// Run over the cluster until we reach the requested number of pixels
for (r = c->rmin<<16; r<=c->rmax<<16; r+=1<<16)
{
for (g = c->vmin<<8; g<=c->vmax<<8; g+=1<<8)
@ -582,9 +582,9 @@ void Cluster_split(T_Cluster * c, T_Cluster * c1, T_Cluster * c2, int hue,
r>>=16;
g>>=8;
// We tried to split on red, but found half of the pixels with r = rmin
// so we enforce some split to happen anyway, instead of creating an empty
// c2 and c1 == c
// We tried to split on red, but found half of the pixels with r = rmin
// so we enforce some split to happen anyway, instead of creating an empty
// c2 and c1 == c
if (r==c->rmin)
r++;
@ -724,15 +724,15 @@ void Cluster_compute_hue(T_Cluster * c,T_Occurrence_table * to)
/*
void CS_Check(T_Cluster_set* cs)
{
int i;
T_Cluster* c = cs->clusters;
for (i = cs->nb; i > 0; i--)
{
assert( c != NULL);
c = c->next;
}
int i;
T_Cluster* c = cs->clusters;
for (i = cs->nb; i > 0; i--)
{
assert( c != NULL);
c = c->next;
}
assert(c == NULL);
assert(c == NULL);
}
*/
@ -762,8 +762,8 @@ T_Cluster_set * CS_New(int nbmax, T_Occurrence_table * to)
// Copy requested params
n->nb_max = OT_count_colors(to);
// If the number of colors asked is > 256, we ceil it because we know we
// don't want more
// If the number of colors asked is > 256, we ceil it because we know we
// don't want more
if (n->nb_max > nbmax)
{
n->nb_max = nbmax;
@ -787,14 +787,14 @@ T_Cluster_set * CS_New(int nbmax, T_Occurrence_table * to)
/// Free a cluster set
void CS_Delete(T_Cluster_set * cs)
{
T_Cluster* nxt;
while (cs->clusters != NULL)
{
nxt = cs->clusters->next;
free(cs->clusters);
cs->clusters = nxt;
}
free(cs);
T_Cluster* nxt;
while (cs->clusters != NULL)
{
nxt = cs->clusters->next;
free(cs->clusters);
cs->clusters = nxt;
}
free(cs);
cs = NULL;
}
@ -817,8 +817,8 @@ void CS_Get(T_Cluster_set * cs, T_Cluster * c)
(current->bmin < current->bmax) )
break;
prev = current;
prev = current;
} while((current = current -> next));
// copy it to c
@ -828,9 +828,9 @@ void CS_Get(T_Cluster_set * cs, T_Cluster * c)
cs->nb--;
if(prev)
prev->next = current->next;
prev->next = current->next;
else
cs->clusters = current->next;
cs->clusters = current->next;
free(current);
current = NULL;
}
@ -845,8 +845,8 @@ void CS_Set(T_Cluster_set * cs,T_Cluster * c)
// Search the first cluster that is smaller than ours (less pixels)
while (current && current->occurences > c->occurences)
{
prev = current;
current = current->next;
prev = current;
current = current->next;
}
// Now insert our cluster just before the one we found
@ -885,12 +885,12 @@ void CS_Generate(T_Cluster_set * cs, T_Occurrence_table * to)
// Split it
Cluster_split(&current, &Nouveau1, &Nouveau2, current.plus_large, to);
// Pack the 2 new clusters (the split may leave some empty space between the
// box border and the first actual pixel)
// Pack the 2 new clusters (the split may leave some empty space between the
// box border and the first actual pixel)
Cluster_pack(&Nouveau1, to);
Cluster_pack(&Nouveau2, to);
// Put them back in the list
// Put them back in the list
CS_Set(cs,&Nouveau1);
CS_Set(cs,&Nouveau2);
@ -914,69 +914,69 @@ void CS_Compute_colors(T_Cluster_set * cs, T_Occurrence_table * to)
/// Sort the clusters by chrominance value
void CS_Sort_by_chrominance(T_Cluster_set * cs)
{
T_Cluster* nc;
T_Cluster* prev = NULL;
T_Cluster* place;
T_Cluster* newlist = NULL;
T_Cluster* nc;
T_Cluster* prev = NULL;
T_Cluster* place;
T_Cluster* newlist = NULL;
while (cs->clusters)
{
// Remove the first cluster from the original list
nc = cs->clusters;
cs->clusters = cs->clusters->next;
while (cs->clusters)
{
// Remove the first cluster from the original list
nc = cs->clusters;
cs->clusters = cs->clusters->next;
// Find his position in the new list
for (place = newlist; place != NULL; place = place->next)
{
if (place->h > nc->h) break;
prev = place;
}
// Find his position in the new list
for (place = newlist; place != NULL; place = place->next)
{
if (place->h > nc->h) break;
prev = place;
}
// Chain it there
nc->next = place;
if (prev) prev->next = nc;
else newlist = nc;
// Chain it there
nc->next = place;
if (prev) prev->next = nc;
else newlist = nc;
prev = NULL;
}
prev = NULL;
}
// Put the new list back in place
cs->clusters = newlist;
// Put the new list back in place
cs->clusters = newlist;
}
/// Sort the clusters by luminance value
void CS_Sort_by_luminance(T_Cluster_set * cs)
{
T_Cluster* nc;
T_Cluster* prev = NULL;
T_Cluster* place;
T_Cluster* newlist = NULL;
T_Cluster* nc;
T_Cluster* prev = NULL;
T_Cluster* place;
T_Cluster* newlist = NULL;
while (cs->clusters)
{
// Remove the first cluster from the original list
nc = cs->clusters;
cs->clusters = cs->clusters->next;
while (cs->clusters)
{
// Remove the first cluster from the original list
nc = cs->clusters;
cs->clusters = cs->clusters->next;
// Find its position in the new list
for (place = newlist; place != NULL; place = place->next)
{
if (place->l > nc->l) break;
prev = place;
}
// Find its position in the new list
for (place = newlist; place != NULL; place = place->next)
{
if (place->l > nc->l) break;
prev = place;
}
// Chain it there
nc->next = place;
if (prev) prev->next = nc;
else newlist = nc;
// Chain it there
nc->next = place;
if (prev) prev->next = nc;
else newlist = nc;
// reset prev pointer
prev = NULL;
}
// reset prev pointer
prev = NULL;
}
// Put the new list back in place
cs->clusters = newlist;
// Put the new list back in place
cs->clusters = newlist;
}
@ -997,7 +997,7 @@ void CS_Generate_color_table_and_palette(T_Cluster_set * cs,T_Conversion_table *
for (g=current->Gmin;g<=current->Vmax;g++)
for (b=current->Bmin;b<=current->Bmax;b++)
CT_set(tc,r,g,b,index);
current = current->next;
current = current->next;
}
}
@ -1053,62 +1053,62 @@ void GS_Generate(T_Gradient_set * ds,T_Cluster_set * cs)
int best_gradient; // Meilleur dgrad
int best_diff; // Meilleure diffrence de chrominance
int diff; // difference de chrominance courante
T_Cluster * current = cs->clusters;
T_Cluster * current = cs->clusters;
// Pour chacun des clusters … traiter
do
{
// On recherche le dgrad le plus proche de la chrominance du cluster
best_gradient=-1;
best_diff=99999999;
for (id=0;id<ds->nb;id++)
{
diff=abs(current->h - ds->gradients[id].hue);
if ((best_diff>diff) && (diff<16))
{
best_gradient=id;
best_diff=diff;
}
}
{
// On recherche le dgrad le plus proche de la chrominance du cluster
best_gradient=-1;
best_diff=99999999;
for (id=0;id<ds->nb;id++)
{
diff=abs(current->h - ds->gradients[id].hue);
if ((best_diff>diff) && (diff<16))
{
best_gradient=id;
best_diff=diff;
}
}
// Si on a trouv un dgrad dans lequel inclure le cluster
if (best_gradient!=-1)
{
// On met … jour le dgrad
if (current->h < ds->gradients[best_gradient].min)
ds->gradients[best_gradient].min=current->h;
if (current->h > ds->gradients[best_gradient].max)
ds->gradients[best_gradient].max=current->h;
ds->gradients[best_gradient].hue=((ds->gradients[best_gradient].hue*
ds->gradients[best_gradient].nb_colors)
+current->h)
/(ds->gradients[best_gradient].nb_colors+1);
ds->gradients[best_gradient].nb_colors++;
}
else
{
// On cre un nouveau dgrad
best_gradient=ds->nb;
ds->gradients[best_gradient].nb_colors=1;
ds->gradients[best_gradient].min=current->h;
ds->gradients[best_gradient].max=current->h;
ds->gradients[best_gradient].hue=current->h;
ds->nb++;
}
current->h=best_gradient;
} while((current = current->next));
// Si on a trouv un dgrad dans lequel inclure le cluster
if (best_gradient!=-1)
{
// On met … jour le dgrad
if (current->h < ds->gradients[best_gradient].min)
ds->gradients[best_gradient].min=current->h;
if (current->h > ds->gradients[best_gradient].max)
ds->gradients[best_gradient].max=current->h;
ds->gradients[best_gradient].hue=((ds->gradients[best_gradient].hue*
ds->gradients[best_gradient].nb_colors)
+current->h)
/(ds->gradients[best_gradient].nb_colors+1);
ds->gradients[best_gradient].nb_colors++;
}
else
{
// On cre un nouveau dgrad
best_gradient=ds->nb;
ds->gradients[best_gradient].nb_colors=1;
ds->gradients[best_gradient].min=current->h;
ds->gradients[best_gradient].max=current->h;
ds->gradients[best_gradient].hue=current->h;
ds->nb++;
}
current->h=best_gradient;
} while((current = current->next));
// On redistribue les valeurs dans les clusters
current = cs -> clusters;
do
current->h=ds->gradients[current->h].hue;
while((current = current ->next));
// On redistribue les valeurs dans les clusters
current = cs -> clusters;
do
current->h=ds->gradients[current->h].hue;
while((current = current ->next));
}
/// Compute best palette for given picture.
T_Conversion_table * Optimize_palette(T_Bitmap24B image, int size,
T_Components * palette, int r, int g, int b)
T_Components * palette, int r, int g, int b)
{
T_Occurrence_table * to;
T_Conversion_table * tc;
@ -1120,13 +1120,13 @@ T_Conversion_table * Optimize_palette(T_Bitmap24B image, int size,
to = OT_new(r, g, b);
if (to == NULL)
return 0;
return 0;
tc = CT_new(r, g, b);
if (tc == NULL)
{
OT_delete(to);
return 0;
OT_delete(to);
return 0;
}
// Count pixels for each color
@ -1137,7 +1137,7 @@ T_Conversion_table * Optimize_palette(T_Bitmap24B image, int size,
{
CT_delete(tc);
OT_delete(to);
return 0;
return 0;
}
//CS_Check(cs);
// Ok, everything was allocated
@ -1153,8 +1153,8 @@ T_Conversion_table * Optimize_palette(T_Bitmap24B image, int size,
ds = GS_New(cs);
if (ds!= NULL)
{
GS_Generate(ds, cs);
GS_Delete(ds);
GS_Generate(ds, cs);
GS_Delete(ds);
}
// Sort the clusters on L and H to get a nice palette
CS_Sort_by_luminance(cs);
@ -1286,8 +1286,8 @@ void Convert_24b_bitmap_to_256_Floyd_Steinberg(T_Bitmap256 dest,T_Bitmap24B sour
/// Converts from 24b to 256c without dithering, using given conversion table
void Convert_24b_bitmap_to_256_nearest_neighbor(T_Bitmap256 dest,
T_Bitmap24B source, int width, int height, __attribute__((unused)) T_Components * palette,
T_Conversion_table * tc)
T_Bitmap24B source, int width, int height, __attribute__((unused)) T_Components * palette,
T_Conversion_table * tc)
{
T_Bitmap24B current;
T_Bitmap256 d;
@ -1310,7 +1310,7 @@ void Convert_24b_bitmap_to_256_nearest_neighbor(T_Bitmap256 dest,
green = current->G;
blue = current->B;
// Cherche la couleur correspondant dans la palette et la range dans
// l'image de destination
// l'image de destination
*d = CT_get(tc, red, green, blue);
// On passe au pixel suivant :

View File

@ -299,14 +299,14 @@ void Freehand_mode2_1_2(void)
if ( (start_x!=Paintbrush_X) || (start_y!=Paintbrush_Y) )
{
Print_coordinates();
if (SDL_GetTicks()>Airbrush_next_time)
{
Airbrush_next_time+=Airbrush_delay*10;
Hide_cursor();
// On affiche définitivement le pinceau
Display_paintbrush(Paintbrush_X,Paintbrush_Y,Fore_color,0);
Display_cursor();
}
if (SDL_GetTicks()>Airbrush_next_time)
{
Airbrush_next_time+=Airbrush_delay*10;
Hide_cursor();
// On affiche définitivement le pinceau
Display_paintbrush(Paintbrush_X,Paintbrush_Y,Fore_color,0);
Display_cursor();
}
}
Operation_push(Paintbrush_X);
@ -328,9 +328,9 @@ void Freehand_mode2_2_0(void)
Operation_push(Paintbrush_X);
Operation_push(Paintbrush_Y);
Print_coordinates();
Airbrush_next_time = SDL_GetTicks() + Airbrush_delay*10;
// On affiche définitivement le pinceau
Display_paintbrush(Paintbrush_X,Paintbrush_Y,Back_color,0);
Airbrush_next_time = SDL_GetTicks() + Airbrush_delay*10;
// On affiche définitivement le pinceau
Display_paintbrush(Paintbrush_X,Paintbrush_Y,Back_color,0);
}
@ -350,14 +350,14 @@ void Freehand_mode2_2_2(void)
if ( (start_x!=Paintbrush_X) || (start_y!=Paintbrush_Y) )
{
Print_coordinates();
if (SDL_GetTicks()>Airbrush_next_time)
{
Airbrush_next_time+=Airbrush_delay*10;
Hide_cursor();
// On affiche définitivement le pinceau
Display_paintbrush(Paintbrush_X,Paintbrush_Y,Back_color,0);
Display_cursor();
}
if (SDL_GetTicks()>Airbrush_next_time)
{
Airbrush_next_time+=Airbrush_delay*10;
Hide_cursor();
// On affiche définitivement le pinceau
Display_paintbrush(Paintbrush_X,Paintbrush_Y,Back_color,0);
Display_cursor();
}
}
Operation_push(Paintbrush_X);
@ -3425,60 +3425,60 @@ void Grad_rectangle_0_5(void)
|| Min(ray, rby) > Main_image_height // Rectangle below picture
|| Min(ray, rby) - 1 - Main_offset_Y > Menu_Y ) // Rectangle below viewport
{
Operation_pop(&rby); // reset the stack
return; // cancel the operation
Operation_pop(&rby); // reset the stack
return; // cancel the operation
}
// Handle clipping
if (Max(rax, rbx)-Main_offset_X > Min(Main_image_width,
Main_magnifier_mode?Main_separator_position:Screen_width))
{
offset_width = Max(rax, rbx) - Min(Main_image_width,
Main_magnifier_mode?Main_separator_position:Screen_width);
}
// Handle clipping
if (Max(rax, rbx)-Main_offset_X > Min(Main_image_width,
Main_magnifier_mode?Main_separator_position:Screen_width))
{
offset_width = Max(rax, rbx) - Min(Main_image_width,
Main_magnifier_mode?Main_separator_position:Screen_width);
}
if (Max(ray, rby)-Main_offset_Y > Min(Main_image_height, Menu_Y))
offset_height = Max(ray, rby) - Min(Main_image_height, Menu_Y);
if (Max(ray, rby)-Main_offset_Y > Min(Main_image_height, Menu_Y))
offset_height = Max(ray, rby) - Min(Main_image_height, Menu_Y);
// Dessin dans la zone de dessin normale
Horizontal_XOR_line(Min(rax, rbx)-Main_offset_X,
Min(ray, rby) - Main_offset_Y, width - offset_width);
// Dessin dans la zone de dessin normale
Horizontal_XOR_line(Min(rax, rbx)-Main_offset_X,
Min(ray, rby) - Main_offset_Y, width - offset_width);
// If not, this line is out of the picture so there is no need to draw it
if (offset_height == 0 || Max(ray, rby) - 1 > Menu_Y + Main_offset_Y )
{
Horizontal_XOR_line(Min(rax, rbx) - Main_offset_X, Max(ray, rby) - 1
- Main_offset_Y, width - offset_width);
}
// If not, this line is out of the picture so there is no need to draw it
if (offset_height == 0 || Max(ray, rby) - 1 > Menu_Y + Main_offset_Y )
{
Horizontal_XOR_line(Min(rax, rbx) - Main_offset_X, Max(ray, rby) - 1
- Main_offset_Y, width - offset_width);
}
if (height > offset_height) {
Vertical_XOR_line(Min(rax, rbx)-Main_offset_X, Min(ray, rby)
- Main_offset_Y, height - offset_height);
Vertical_XOR_line(Min(rax, rbx)-Main_offset_X, Min(ray, rby)
- Main_offset_Y, height - offset_height);
if (offset_width == 0)
{
Vertical_XOR_line(Max(rax, rbx) - 1 - Main_offset_X, Min(ray, rby)
- Main_offset_Y, height - offset_height);
}
if (offset_width == 0)
{
Vertical_XOR_line(Max(rax, rbx) - 1 - Main_offset_X, Min(ray, rby)
- Main_offset_Y, height - offset_height);
}
}
Update_rect(Min(rax, rbx) - Main_offset_X, Min(ray, rby) - Main_offset_Y,
width + 1 - offset_width, height + 1 - offset_height);
Update_rect(Min(rax, rbx) - Main_offset_X, Min(ray, rby) - Main_offset_Y,
width + 1 - offset_width, height + 1 - offset_height);
// Dessin dans la zone zoomée
if (Main_magnifier_mode && Min(rax, rbx) <= Limit_right_zoom
&& Max(rax, rbx) > Limit_left_zoom
&& Min(ray, rby) <= Limit_bottom_zoom
&& Max(ray, rby) > Limit_top_zoom )
&& Max(rax, rbx) > Limit_left_zoom
&& Min(ray, rby) <= Limit_bottom_zoom
&& Max(ray, rby) > Limit_top_zoom )
{
offset_width = 0;
offset_height = 0;
offset_width = 0;
offset_height = 0;
if (Min(rax, rbx)<=Limit_left_zoom) // On dépasse du zoom à gauche
{
offset_width += Limit_left_zoom - Min(rax, rbx);
offset_left = Limit_left_zoom;
}
if (Min(rax, rbx)<=Limit_left_zoom) // On dépasse du zoom à gauche
{
offset_width += Limit_left_zoom - Min(rax, rbx);
offset_left = Limit_left_zoom;
}
if(Max(rax,rbx)>Limit_right_zoom) // On dépasse du zoom à droite
offset_width += Max(rax,rbx) - Limit_right_zoom - 1;
@ -3604,8 +3604,8 @@ void Grad_rectangle_12_7(void)
// Dessin dans la zone zoomée
if (Main_magnifier_mode && Min(rax, rbx) <= Limit_right_zoom
&& Max(rax, rbx)>Limit_left_zoom && Min(ray, rby) <= Limit_bottom_zoom
&& Max(ray,rby)>Limit_top_zoom )
&& Max(rax, rbx)>Limit_left_zoom && Min(ray, rby) <= Limit_bottom_zoom
&& Max(ray,rby)>Limit_top_zoom )
{
offset_width = 0;
offset_height=0;
@ -3758,10 +3758,10 @@ void Grad_rectangle_0_9(void)
// Dessin dans la zone zoomée
if (Main_magnifier_mode
&& Min(rect_start_x, rect_end_x) <= Limit_right_zoom
&& Max(rect_start_x, rect_end_x) > Limit_left_zoom
&& Min(rect_start_y, rect_end_y) <= Limit_bottom_zoom
&& Max(rect_start_y, rect_end_y) > Limit_top_zoom )
&& Min(rect_start_x, rect_end_x) <= Limit_right_zoom
&& Max(rect_start_x, rect_end_x) > Limit_left_zoom
&& Min(rect_start_y, rect_end_y) <= Limit_bottom_zoom
&& Max(rect_start_y, rect_end_y) > Limit_top_zoom )
{
offset_width = 0;
offset_height=0;

View File

@ -715,15 +715,15 @@ int Load_INI(T_Config * conf)
// Do that only if the first mode is actually windowed (not the case on gp2x for example)
if(Video_mode[0].Fullscreen==0)
{
Video_mode[0].Width = 640;
Video_mode[0].Height = 480;
if (!Load_INI_get_values (file,buffer,"Default_window_size",2,values))
{
if ((values[0]>=320))
Video_mode[0].Width = values[0];
if ((values[1]>=200))
Video_mode[0].Height = values[1];
}
Video_mode[0].Width = 640;
Video_mode[0].Height = 480;
if (!Load_INI_get_values (file,buffer,"Default_window_size",2,values))
{
if ((values[0]>=320))
Video_mode[0].Width = values[0];
if ((values[1]>=200))
Video_mode[0].Height = values[1];
}
}
conf->Mouse_merge_movement=100;
@ -823,14 +823,14 @@ int Load_INI(T_Config * conf)
// Optional, name of skin file. (>2.0)
if(!Load_INI_get_string(file,buffer,"Skin_file",value_label,1))
{
conf->Skin_file = strdup(value_label);
conf->Skin_file = strdup(value_label);
}
else
conf->Skin_file = strdup("skin_modern.png");
// Optional, name of font file. (>2.0)
if(!Load_INI_get_string(file,buffer,"Font_file",value_label,1))
conf->Font_file = strdup(value_label);
conf->Font_file = strdup(value_label);
else
conf->Font_file = strdup("font_Classic.png");

View File

@ -118,8 +118,8 @@ void Set_config_directory(const char * program_dir, char * config_dir)
strcpy(config_dir,"PROGDIR:");
// GP2X
#elif defined(__GP2X__)
// On the GP2X, the program is installed to the sdcard, and we don't want to mess with the system tree which is
// on an internal flash chip. So, keep these settings locals.
// On the GP2X, the program is installed to the sdcard, and we don't want to mess with the system tree which is
// on an internal flash chip. So, keep these settings locals.
strcpy(config_dir,program_dir);
#else
char filename[MAX_PATH_CHARACTERS];

12
shade.c
View File

@ -617,12 +617,12 @@ int Menu_shade(void)
}
break;
case 5: // Ok
if (selection_start == selection_end && Shade_list[Shade_current].List[selection_start] > 0)
Set_fore_color(Shade_list[Shade_current].List[selection_start]);
else if (first_color == last_color)
Set_fore_color(first_color);
break;
case 5: // Ok
if (selection_start == selection_end && Shade_list[Shade_current].List[selection_start] > 0)
Set_fore_color(Shade_list[Shade_current].List[selection_start]);
else if (first_color == last_color)
Set_fore_color(first_color);
break;
case 6 : // Copy
memcpy(buffer,Shade_list[Shade_current].List,512*sizeof(word));

View File

@ -38,7 +38,7 @@
// POSIX calls it strcasecmp, Windows uses stricmp... no ANSI standard.
#ifdef WIN32
#define strcasecmp stricmp
#define strcasecmp stricmp
#endif
// Definition of the base data types