From 45524de886dca812dfb9777dfa589b640181b189 Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Wed, 2 Dec 2009 00:41:37 +0000 Subject: [PATCH] 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 --- buttons.c | 4 ++++ graph.c | 11 +++++++---- misc.c | 3 +++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/buttons.c b/buttons.c index 2e1aefc7..39390c97 100644 --- a/buttons.c +++ b/buttons.c @@ -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; } diff --git a/graph.c b/graph.c index a0231fc2..c4134049 100644 --- a/graph.c +++ b/graph.c @@ -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_posPages->Nb_layers; layer++) + for (y_pos=0;y_posPages->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; layerPages->Nb_layers; layer++) + Remap_general_lowlevel(used,Spare_backups->Pages->Image[layer],Spare_image_width,Spare_image_height,Spare_image_width); } diff --git a/misc.c b/misc.c index 47ac7d80..9647542f 100644 --- a/misc.c +++ b/misc.c @@ -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)