[layers] work on layer sharing (still stable)

git-svn-id: svn://pulkomandy.tk/GrafX2/branches/layers@1045 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2009-09-28 21:01:29 +00:00
parent 057d5e76e4
commit 2fd88b81bb
8 changed files with 30 additions and 16 deletions

View File

@ -507,6 +507,7 @@ void Button_Clear(void)
Hide_current_image_with_stencil(0,Stencil);
else
Hide_current_image(0);
Redraw_layered_image();
Display_all_screen();
End_of_modification();
Unselect_button(BUTTON_CLEAR);
@ -521,6 +522,7 @@ void Button_Clear_with_backcolor(void)
Hide_current_image_with_stencil(Back_color,Stencil);
else
Hide_current_image(Back_color);
Redraw_layered_image();
Display_all_screen();
End_of_modification();
Unselect_button(BUTTON_CLEAR);

View File

@ -662,7 +662,8 @@ void Get_colors_from_brush(void)
if (Confirmation_box("Modify current palette ?"))
{
Backup();
// Backup with unchanged layers, only palette is modified
Backup_layers(0);
// On commence par initialiser le tableau de booléen à faux
for (color=0;color<=255;color++)

10
misc.c
View File

@ -175,16 +175,16 @@ void Hide_current_image_with_stencil(byte color, byte * stencil)
int nb_pixels=0; //ECX
//al=color
//edi=Screen_pixels
byte* Pixel_Courant=Screen_pixels; //dl
byte* pixel=Main_backups->Pages->Image[Main_current_layer];
int i;
nb_pixels=Main_image_height*Main_image_width;
for(i=0;i<nb_pixels;i++)
{
if (stencil[*Pixel_Courant]==0)
*Pixel_Courant=color;
Pixel_Courant++;
if (stencil[*pixel]==0)
*pixel=color;
pixel++;
}
}
@ -192,7 +192,7 @@ void Hide_current_image(byte color)
// Effacer l'image courante avec une certaine couleur
{
memset(
Main_screen ,
Main_backups->Pages->Image[Main_current_layer],
color ,
Main_image_width * Main_image_height
);

View File

@ -3909,12 +3909,15 @@ void Scroll_12_0(void)
//
{
Init_start_operation();
Backup();
Operation_push(Paintbrush_X);
Operation_push(Paintbrush_Y);
Operation_push(Paintbrush_X);
Operation_push(Paintbrush_Y);
Operation_push(Mouse_K); // LEFT_SIDE or RIGHT_SIDE
if (Mouse_K == LEFT_SIDE)
Backup();
else
Backup_layers(Main_layers_visible);
Cursor_hidden_before_scroll=Cursor_hidden;
Cursor_hidden=1;

View File

@ -648,6 +648,11 @@ int Backup_and_resize_the_spare(int width,int height)
void Backup(void)
// Sauve la page courante comme première page de backup et crée une nouvelle page
// pur continuer à dessiner. Utilisé par exemple pour le fill
{
Backup_layers(1<<Main_current_layer);
}
void Backup_layers(byte layer_mask)
{
int i;

View File

@ -72,7 +72,10 @@ int Init_all_backup_lists(int width,int height);
void Set_number_of_backups(int nb_backups);
int Backup_with_new_dimensions(int upload,int width,int height);
int Backup_and_resize_the_spare(int width,int height);
/// Backup with a new copy for the working layer, and references for all others.
void Backup(void);
/// Backup with a new copy of some layers (the others are references).
void Backup_layers(byte layer_mask);
void Undo(void);
void Redo(void);
void Free_current_page(void); // 'Kill' button

View File

@ -1276,7 +1276,7 @@ void Button_Palette(void)
// est en mode X-SWAP.
if (!image_is_backed_up)
{
Backup();
Backup_layers(-1);
image_is_backed_up=1;
}
@ -1403,7 +1403,7 @@ void Button_Palette(void)
memcpy(backup_palette,working_palette,sizeof(T_Palette));
if (!image_is_backed_up)
{
Backup();
Backup_layers(-1);
image_is_backed_up=1;
}
Reduce_palette(&used_colors,reduce_colors_number,working_palette,color_usage);
@ -1780,7 +1780,7 @@ void Button_Palette(void)
{
if (!image_is_backed_up)
{
Backup();
Backup_layers(-1);
image_is_backed_up=1;
}
Hide_cursor();
@ -1880,7 +1880,7 @@ void Button_Palette(void)
// Make a backup because remapping is an undoable modification
if (!image_is_backed_up)
{
Backup();
Backup_layers(-1);
image_is_backed_up=1;
}
@ -2024,7 +2024,7 @@ void Button_Palette(void)
// de ne pas trop modifier l'image.
if (!image_is_backed_up)
{
Backup();
Backup_layers(-1);
image_is_backed_up=1;
}
if (used_colors==-1)
@ -2126,9 +2126,9 @@ void Button_Palette(void)
{
if ( (!image_is_backed_up)
&& memcmp(Main_palette,working_palette,sizeof(T_Palette)) )
Backup();
Backup_layers(-1);
memcpy(Main_palette,working_palette,sizeof(T_Palette));
// End_of_modification();
End_of_modification();
// Not really needed, the change was in palette entries
}

View File

@ -1 +1 @@
char Program_version[]="2.2wip";
char Program_version[]="layers wip";