Moved skin preview to the Gfx struct so it is not overwritten if you cancel skin loading.

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1115 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2009-10-31 11:19:44 +00:00
parent a2fd796e59
commit 2b02ff505f
6 changed files with 12 additions and 11 deletions

View File

@ -1111,7 +1111,7 @@ void Button_Skins(void)
for (y = 14, offs_y = 0; offs_y < 16; offs_y++, y++) for (y = 14, offs_y = 0; offs_y < 16; offs_y++, y++)
for (x = 6, x_pos = 0; x_pos<173; x_pos++, x++) for (x = 6, x_pos = 0; x_pos<173; x_pos++, x++)
Pixel_in_window(x, y, skin_logo[offs_y][x_pos]); Pixel_in_window(x, y, Gfx->preview[offs_y][x_pos]);
Update_window_area(0, 0, Window_width, Window_height); Update_window_area(0, 0, Window_width, Window_height);
@ -1153,13 +1153,13 @@ void Button_Skins(void)
for (y = 14, offs_y = 0; offs_y < 16; offs_y++, y++) for (y = 14, offs_y = 0; offs_y < 16; offs_y++, y++)
for (x = 6, x_pos = 0; x_pos<173; x_pos++, x++) for (x = 6, x_pos = 0; x_pos<173; x_pos++, x++)
{ {
if (skin_logo[offs_y][x_pos] == MC_Black) if (gfx->preview[offs_y][x_pos] == MC_Black)
Pixel_in_window(x, y, Old_black); Pixel_in_window(x, y, Old_black);
else if (skin_logo[offs_y][x_pos] == MC_Dark) else if (gfx->preview[offs_y][x_pos] == MC_Dark)
Pixel_in_window(x, y, Old_dark); Pixel_in_window(x, y, Old_dark);
else if (skin_logo[offs_y][x_pos] == MC_Light) else if (gfx->preview[offs_y][x_pos] == MC_Light)
Pixel_in_window(x, y, Old_light); Pixel_in_window(x, y, Old_light);
else if (skin_logo[offs_y][x_pos] == MC_White) else if (gfx->preview[offs_y][x_pos] == MC_White)
Pixel_in_window(x, y, Old_white); Pixel_in_window(x, y, Old_white);
} }
Update_window_area(4, 14, 174, 16); Update_window_area(4, 14, 174, 16);

View File

@ -805,9 +805,6 @@ GFX2_GLOBAL byte * Menu_font;
/// Pointer to the current active skin. /// Pointer to the current active skin.
GFX2_GLOBAL T_Gui_skin * Gfx; GFX2_GLOBAL T_Gui_skin * Gfx;
/// Logo of skin
byte skin_logo[16][173];
// -- Help data // -- Help data
/// Index of the ::Help_section shown by the Help screen. /// Index of the ::Help_section shown by the Help screen.

2
init.c
View File

@ -350,7 +350,7 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
cursor_x += MENU_WIDTH; cursor_x += MENU_WIDTH;
if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "logo")) if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "logo"))
return 1; return 1;
if (Read_GUI_block(gui, cursor_x, cursor_y, skin_logo, 173, 16, "logo", 0)) if (Read_GUI_block(gui, cursor_x, cursor_y, gfx->preview, 173, 16, "logo", 0))
return 1; return 1;
cursor_y+=MENU_HEIGHT; cursor_y+=MENU_HEIGHT;

2
op_c.c
View File

@ -1206,7 +1206,7 @@ void Convert_24b_bitmap_to_256_Floyd_Steinberg(T_Bitmap256 dest,T_Bitmap24B sour
} }
void Convert_24b_bitmap_to_256_nearest_neighbor(T_Bitmap256 dest, void Convert_24b_bitmap_to_256_nearest_neighbor(T_Bitmap256 dest,
T_Bitmap24B source, int width, int height, T_Components * palette, T_Bitmap24B source, int width, int height, __attribute__((unused)) T_Components * palette,
T_Conversion_table * tc) T_Conversion_table * tc)
{ {
T_Bitmap24B current; T_Bitmap24B current;

View File

@ -426,6 +426,10 @@ typedef struct
/// A default 256-color palette. /// A default 256-color palette.
T_Palette Default_palette; T_Palette Default_palette;
/// Preview for displaying in the skin dialog
byte preview[16][173];
} T_Gui_skin; } T_Gui_skin;

View File

@ -2678,7 +2678,7 @@ void Remap_menu_sprites()
// Skin preview // Skin preview
for (j = 0; j < 173; j++) for (j = 0; j < 173; j++)
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
Remap_pixel(&skin_logo[i][j]); Remap_pixel(&Gfx->preview[i][j]);
} }
Clear_border(MC_Black); Clear_border(MC_Black);
} }