[layers] Limited to 32 layers. (previously there was no limit and the 16-bit depth buffer wrapped). Fixed a display bug after picture transforms or layers add/del.
git-svn-id: svn://pulkomandy.tk/GrafX2/branches/layers@1075 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
2dcc1cf8bd
commit
abb6204757
2
engine.c
2
engine.c
@ -1042,6 +1042,7 @@ void Main_handler(void)
|
|||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
|
End_of_modification();
|
||||||
}
|
}
|
||||||
action++;
|
action++;
|
||||||
break;
|
break;
|
||||||
@ -1054,6 +1055,7 @@ void Main_handler(void)
|
|||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
|
End_of_modification();
|
||||||
}
|
}
|
||||||
action++;
|
action++;
|
||||||
break;
|
break;
|
||||||
|
|||||||
4
global.h
4
global.h
@ -348,7 +348,7 @@ GFX2_GLOBAL short Main_magnifier_offset_Y;
|
|||||||
/// Index of layer currently being edited
|
/// Index of layer currently being edited
|
||||||
GFX2_GLOBAL int Main_current_layer;
|
GFX2_GLOBAL int Main_current_layer;
|
||||||
/// Bitfield that records which layers are visible. 2^0 for 0, 2^1 for 1, 2^2 for 2, etc.
|
/// Bitfield that records which layers are visible. 2^0 for 0, 2^1 for 1, 2^2 for 2, etc.
|
||||||
GFX2_GLOBAL word Main_layers_visible;
|
GFX2_GLOBAL dword Main_layers_visible;
|
||||||
|
|
||||||
// -- Spare page data
|
// -- Spare page data
|
||||||
|
|
||||||
@ -412,7 +412,7 @@ GFX2_GLOBAL short Spare_magnifier_offset_Y;
|
|||||||
/// Index of layer currently being edited
|
/// Index of layer currently being edited
|
||||||
GFX2_GLOBAL short Spare_current_layer;
|
GFX2_GLOBAL short Spare_current_layer;
|
||||||
/// Bitfield that records which layers are visible. 2^0 for 0, 2^1 for 1, 2^2 for 2, etc.
|
/// Bitfield that records which layers are visible. 2^0 for 0, 2^1 for 1, 2^2 for 2, etc.
|
||||||
GFX2_GLOBAL word Spare_layers_visible;
|
GFX2_GLOBAL dword Spare_layers_visible;
|
||||||
// -- Image backups
|
// -- Image backups
|
||||||
|
|
||||||
/// Backup of the current screen, used during drawing when FX feedback is OFF.
|
/// Backup of the current screen, used during drawing when FX feedback is OFF.
|
||||||
|
|||||||
4
main.c
4
main.c
@ -370,9 +370,9 @@ int Init_program(int argc,char * argv[])
|
|||||||
Main_fileselector_offset=0; // Au début, le fileselect est en haut de la liste des fichiers
|
Main_fileselector_offset=0; // Au début, le fileselect est en haut de la liste des fichiers
|
||||||
Main_format=0;
|
Main_format=0;
|
||||||
Main_current_layer=0;
|
Main_current_layer=0;
|
||||||
Main_layers_visible=0xFFFF;
|
Main_layers_visible=0xFFFFFFFF;
|
||||||
Spare_current_layer=0;
|
Spare_current_layer=0;
|
||||||
Spare_layers_visible=0xFFFF;
|
Spare_layers_visible=0xFFFFFFFF;
|
||||||
|
|
||||||
Spare_fileselector_position=0;
|
Spare_fileselector_position=0;
|
||||||
Spare_fileselector_offset=0;
|
Spare_fileselector_offset=0;
|
||||||
|
|||||||
26
pages.c
26
pages.c
@ -36,7 +36,7 @@
|
|||||||
///
|
///
|
||||||
|
|
||||||
/// Bitfield which records which layers are backed up in Page 0.
|
/// Bitfield which records which layers are backed up in Page 0.
|
||||||
static word Last_backed_up_layers=0;
|
static dword Last_backed_up_layers=0;
|
||||||
|
|
||||||
/// Total number of unique bitmaps (layers, animation frames, backups)
|
/// Total number of unique bitmaps (layers, animation frames, backups)
|
||||||
long Stats_pages_number=0;
|
long Stats_pages_number=0;
|
||||||
@ -483,7 +483,7 @@ void Free_last_page_of_list(T_List_of_pages * list)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// layer_mask tells which layers have to be fresh copies instead of references
|
// layer_mask tells which layers have to be fresh copies instead of references
|
||||||
int Create_new_page(T_Page * new_page, T_List_of_pages * list, word layer_mask)
|
int Create_new_page(T_Page * new_page, T_List_of_pages * list, dword layer_mask)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Cette fonction crée une nouvelle page dont les attributs correspondent à
|
// Cette fonction crée une nouvelle page dont les attributs correspondent à
|
||||||
@ -697,7 +697,7 @@ int Backup_with_new_dimensions(int upload,byte layers,int width,int height)
|
|||||||
Upload_infos_page_main(new_page);
|
Upload_infos_page_main(new_page);
|
||||||
new_page->Width=width;
|
new_page->Width=width;
|
||||||
new_page->Height=height;
|
new_page->Height=height;
|
||||||
if (Create_new_page(new_page,Main_backups,0xFFFF))
|
if (Create_new_page(new_page,Main_backups,0xFFFFFFFF))
|
||||||
{
|
{
|
||||||
for (i=0; i<layers;i++)
|
for (i=0; i<layers;i++)
|
||||||
{
|
{
|
||||||
@ -739,7 +739,7 @@ int Backup_and_resize_the_spare(int width,int height)
|
|||||||
Upload_infos_page_spare(new_page);
|
Upload_infos_page_spare(new_page);
|
||||||
new_page->Width=width;
|
new_page->Width=width;
|
||||||
new_page->Height=height;
|
new_page->Height=height;
|
||||||
if (Create_new_page(new_page,Spare_backups,0xFFFF))
|
if (Create_new_page(new_page,Spare_backups,0xFFFFFFFF))
|
||||||
{
|
{
|
||||||
byte i;
|
byte i;
|
||||||
|
|
||||||
@ -764,7 +764,7 @@ void Backup(void)
|
|||||||
Backup_layers(1<<Main_current_layer);
|
Backup_layers(1<<Main_current_layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Backup_layers(word layer_mask)
|
void Backup_layers(dword layer_mask)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
T_Page *new_page;
|
T_Page *new_page;
|
||||||
@ -944,6 +944,10 @@ byte Add_layer(T_List_of_pages *list, byte layer)
|
|||||||
|
|
||||||
source_page = list->Pages;
|
source_page = list->Pages;
|
||||||
|
|
||||||
|
// Hard limit of 32 at the moment, because layer bitmasks are 32bit.
|
||||||
|
if (list->Pages->Nb_layers == 32)
|
||||||
|
return 1;
|
||||||
|
|
||||||
// Keep the position reasonable
|
// Keep the position reasonable
|
||||||
if (layer > list->Pages->Nb_layers)
|
if (layer > list->Pages->Nb_layers)
|
||||||
layer = list->Pages->Nb_layers;
|
layer = list->Pages->Nb_layers;
|
||||||
@ -987,9 +991,9 @@ byte Add_layer(T_List_of_pages *list, byte layer)
|
|||||||
|
|
||||||
// Update the flags of visible layers.
|
// Update the flags of visible layers.
|
||||||
{
|
{
|
||||||
word layers_before;
|
dword layers_before;
|
||||||
word layers_after;
|
dword layers_after;
|
||||||
word *visible_layers_flag;
|
dword *visible_layers_flag;
|
||||||
|
|
||||||
// Determine if we're modifying the spare or the main page.
|
// Determine if we're modifying the spare or the main page.
|
||||||
if (list == Main_backups)
|
if (list == Main_backups)
|
||||||
@ -1048,9 +1052,9 @@ byte Delete_layer(T_List_of_pages *list, byte layer)
|
|||||||
|
|
||||||
// Update the flags of visible layers.
|
// Update the flags of visible layers.
|
||||||
{
|
{
|
||||||
word layers_before;
|
dword layers_before;
|
||||||
word layers_after;
|
dword layers_after;
|
||||||
word *visible_layers_flag;
|
dword *visible_layers_flag;
|
||||||
byte new_current_layer;
|
byte new_current_layer;
|
||||||
|
|
||||||
// Determine if we're modifying the spare or the main page.
|
// Determine if we're modifying the spare or the main page.
|
||||||
|
|||||||
4
pages.h
4
pages.h
@ -62,7 +62,7 @@ int Allocate_list_of_pages(T_List_of_pages * list);
|
|||||||
void Backward_in_list_of_pages(T_List_of_pages * list);
|
void Backward_in_list_of_pages(T_List_of_pages * list);
|
||||||
void Advance_in_list_of_pages(T_List_of_pages * list);
|
void Advance_in_list_of_pages(T_List_of_pages * list);
|
||||||
void Free_last_page_of_list(T_List_of_pages * list);
|
void Free_last_page_of_list(T_List_of_pages * list);
|
||||||
int Create_new_page(T_Page * new_page,T_List_of_pages * current_list, word layer_mask);
|
int Create_new_page(T_Page * new_page,T_List_of_pages * current_list, dword layer_mask);
|
||||||
void Change_page_number_of_list(T_List_of_pages * list,int number);
|
void Change_page_number_of_list(T_List_of_pages * list,int number);
|
||||||
void Free_page_of_a_list(T_List_of_pages * list);
|
void Free_page_of_a_list(T_List_of_pages * list);
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ int Backup_and_resize_the_spare(int width,int height);
|
|||||||
/// Backup with a new copy for the working layer, and references for all others.
|
/// Backup with a new copy for the working layer, and references for all others.
|
||||||
void Backup(void);
|
void Backup(void);
|
||||||
/// Backup with a new copy of some layers (the others are references).
|
/// Backup with a new copy of some layers (the others are references).
|
||||||
void Backup_layers(word layer_mask);
|
void Backup_layers(dword layer_mask);
|
||||||
void Undo(void);
|
void Undo(void);
|
||||||
void Redo(void);
|
void Redo(void);
|
||||||
void Free_current_page(void); // 'Kill' button
|
void Free_current_page(void); // 'Kill' button
|
||||||
|
|||||||
@ -481,10 +481,10 @@ void Layer_activate(short layer, short side)
|
|||||||
// Right-click on current layer
|
// Right-click on current layer
|
||||||
if (Main_current_layer == layer)
|
if (Main_current_layer == layer)
|
||||||
{
|
{
|
||||||
if (Main_layers_visible == (1<<layer))
|
if (Main_layers_visible == (dword)(1<<layer))
|
||||||
{
|
{
|
||||||
// Set all layers visible
|
// Set all layers visible
|
||||||
Main_layers_visible = 0xFFFF;
|
Main_layers_visible = 0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -430,6 +430,7 @@ void Button_Transform_menu(void)
|
|||||||
*/
|
*/
|
||||||
Redraw_layered_image();
|
Redraw_layered_image();
|
||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
|
End_of_modification();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user