Temporarily disabled Mask which is not implmented (it would crash on each use). Fixed instant crash in 'Copy to spare / Palette and remap' by doing actual layer-aware implementation

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1234 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2009-12-02 00:41:37 +00:00
parent 7d657e0c02
commit 45524de886
3 changed files with 14 additions and 4 deletions

View File

@ -1367,6 +1367,8 @@ void Button_Copy_page(void)
if ( (!Spare_image_is_modified)
|| (Confirmation_box("Spare page was modified. Proceed?")) )
{
// FIXME: add here some code to backup the spare
if (clicked_button<=2)
Copy_image_only();
@ -1375,6 +1377,8 @@ void Button_Copy_page(void)
if (clicked_button!=2) // copie de la palette
memcpy(Spare_palette,Main_palette,sizeof(T_Palette));
// FIXME: here is the 'end_of_modifications' for spare.
Spare_image_is_modified=1;
}

11
graph.c
View File

@ -631,15 +631,17 @@ void Remap_spare(void)
short y_pos; // Variable de balayage de la brosse
byte used[256]; // Tableau de booléens "La couleur est utilisée"
int color;
byte layer;
// On commence par initialiser le tableau de booléens à faux
for (color=0;color<=255;color++)
used[color]=0;
// On calcule la table d'utilisation des couleurs
for (y_pos=0;y_pos<Spare_image_height;y_pos++)
for (x_pos=0;x_pos<Spare_image_width;x_pos++)
used[Read_pixel_from_spare_screen(x_pos,y_pos)]=1;
for (layer=0; layer<Spare_backups->Pages->Nb_layers; layer++)
for (y_pos=0;y_pos<Spare_image_height;y_pos++)
for (x_pos=0;x_pos<Spare_image_width;x_pos++)
used[*(Spare_backups->Pages->Image[layer]+(y_pos*Spare_image_width+x_pos))]=1;
// On va maintenant se servir de la table "used" comme table de
// conversion: pour chaque indice, la table donne une couleur de
@ -655,7 +657,8 @@ void Remap_spare(void)
// Maintenant qu'on a une super table de conversion qui n'a que le nom
// qui craint un peu, on peut faire l'échange dans la brosse de toutes les
// teintes.
Remap_general_lowlevel(used,Spare_screen,Spare_image_width,Spare_image_height,Spare_image_width);
for (layer=0; layer<Spare_backups->Pages->Nb_layers; layer++)
Remap_general_lowlevel(used,Spare_backups->Pages->Image[layer],Spare_image_width,Spare_image_height,Spare_image_width);
}

3
misc.c
View File

@ -287,7 +287,10 @@ void Copy_part_of_image_to_another(byte * source,word source_x,word source_y,wor
byte Read_pixel_from_spare_screen(word x,word y)
{
return 0;
/* Temporarily disabled. Need to implement a third Visible_image buffer
return *(Spare_screen+y*Spare_image_width+x);
*/
}
void Rotate_90_deg_lowlevel(byte * source, byte * dest, short width, short height)