diff --git a/buttons.c b/buttons.c index e3709d99..fc8a8921 100644 --- a/buttons.c +++ b/buttons.c @@ -4289,12 +4289,8 @@ void Button_Effects(void) Display_cursor(); break; case 13 : // Feedback (pour Colorize et Shade) - if ((Config.FX_Feedback=!Config.FX_Feedback)) //!!! - FX_feedback_screen=Main_backups->Pages->Image[Main_current_layer]; - // Main_screen - else - FX_feedback_screen=Main_backups->Pages->Next->Image[Main_current_layer]; - // Screen_backup + Config.FX_Feedback = !Config.FX_Feedback; + Update_FX_feedback(Config.FX_Feedback); Hide_cursor(); Display_feedback_state(); Display_cursor(); diff --git a/global.h b/global.h index 07a420c4..bcceeb36 100644 --- a/global.h +++ b/global.h @@ -609,12 +609,6 @@ GFX2_GLOBAL struct /// Current effecting function. When no effect is selected this is ::No_effect() GFX2_GLOBAL Func_effect Effect_function; -/// -/// Pointer to the image to read, while drawing. It's either ::Main_screen -/// (the image you draw) when FX feedback is ON, or ::Screen_backup (a backup -/// copy) when FX feedback is off. -GFX2_GLOBAL byte * FX_feedback_screen; - /// /// Array of booleans, indicates which colors should never be picked by /// ::Best_color() diff --git a/graph.c b/graph.c index 98d1bf47..5dd29cb1 100644 --- a/graph.c +++ b/graph.c @@ -934,7 +934,6 @@ void Fill_general(byte fill_color) // { byte cursor_shape_before_fill; - byte * old_fx_feedback_screen; short x_pos,y_pos; short top_reached ,bottom_reached; short left_reached,right_reached; @@ -962,8 +961,7 @@ void Fill_general(byte fill_color) Backup(); // On fait attention au Feedback qui DOIT se faire avec le backup. - old_fx_feedback_screen=FX_feedback_screen; - FX_feedback_screen=Screen_backup; + Update_FX_feedback(0); // On va maintenant "épurer" la zone visible de l'image: memset(replace_table,0,256); @@ -1032,7 +1030,8 @@ void Fill_general(byte fill_color) else Pixel_in_current_screen(x_pos,y_pos,Read_pixel_from_backup_layer(x_pos,y_pos),0); - FX_feedback_screen=old_fx_feedback_screen; + // Restore original feedback value + Update_FX_feedback(Config.FX_Feedback); // A la fin, on n'a pas besoin de réafficher le curseur puisque c'est // l'appelant qui s'en charge, et on n'a pas besoin de rafficher l'image @@ -2541,7 +2540,6 @@ void Polyfill_general(int vertices, short * points, int color) void Polyfill(int vertices, short * points, int color) { int index; - byte *old_fx_feedback_screen; Pixel_clipped(points[0],points[1],color); if (vertices==1) @@ -2552,8 +2550,7 @@ void Polyfill(int vertices, short * points, int color) // Comme pour le Fill, cette operation fait un peu d'"overdraw" // (pixels dessinés plus d'une fois) alors on force le FX Feedback à OFF - old_fx_feedback_screen=FX_feedback_screen; - FX_feedback_screen=Screen_backup; + Update_FX_feedback(0); Pixel_figure=Pixel_clipped; Polyfill_general(vertices,points,color); @@ -2567,8 +2564,8 @@ void Polyfill(int vertices, short * points, int color) Draw_line_general(points[index*2],points[index*2+1],points[index*2+2],points[index*2+3],color); Draw_line_general(points[0],points[1],points[index*2],points[index*2+1],color); - // restore de l'etat du FX Feedback - FX_feedback_screen=old_fx_feedback_screen; + // Restore original feedback value + Update_FX_feedback(Config.FX_Feedback); } diff --git a/layers.c b/layers.c index daf5984c..7253c0ee 100644 --- a/layers.c +++ b/layers.c @@ -83,7 +83,7 @@ void Layer_activate(byte layer, short side) else Update_depth_buffer(); // Only need the depth buffer //Download_infos_page_main(Main_backups->Pages); - //Download_infos_backup(Main_backups); + //Update_FX_feedback(Config.FX_Feedback); Display_all_screen(); Display_layerbar(); Display_cursor(); diff --git a/pages.c b/pages.c index 66b6509e..6ff1ffb2 100644 --- a/pages.c +++ b/pages.c @@ -218,7 +218,7 @@ void Redraw_layered_image(void) #else Update_screen_targets(); #endif - Download_infos_backup(Main_backups); + Update_FX_feedback(Config.FX_Feedback); } void Update_depth_buffer(void) @@ -265,7 +265,7 @@ void Update_depth_buffer(void) } } #endif - Download_infos_backup(Main_backups); + Update_FX_feedback(Config.FX_Feedback); } void Redraw_spare_image(void) @@ -374,13 +374,15 @@ void Upload_infos_page_spare(T_Page * page) } } -void Download_infos_backup(T_List_of_pages * list) +byte * FX_feedback_screen; + +void Update_FX_feedback(byte with_feedback) { - if (Config.FX_Feedback) - FX_feedback_screen=list->Pages->Image[Main_current_layer]; + if (with_feedback) + FX_feedback_screen=Main_backups->Pages->Image[Main_current_layer]; else - FX_feedback_screen=list->Pages->Next->Image[Main_current_layer]; + FX_feedback_screen=Main_backups->Pages->Next->Image[Main_current_layer]; } void Clear_page(T_Page * page) @@ -732,7 +734,7 @@ int Init_all_backup_lists(int width,int height) #endif Download_infos_page_main(Main_backups->Pages); - Download_infos_backup(Main_backups); + Update_FX_feedback(Config.FX_Feedback); // Default values for spare page Spare_backups->Pages->Width = width; @@ -818,7 +820,7 @@ int Backup_with_new_dimensions(int upload,byte layers,int width,int height) #else Update_screen_targets(); #endif - Download_infos_backup(Main_backups); + Update_FX_feedback(Config.FX_Feedback); // -- return_code=1; @@ -904,7 +906,7 @@ void Backup_layers(dword layer_mask) Create_new_page(new_page,Main_backups,layer_mask); Download_infos_page_main(new_page); - Download_infos_backup(Main_backups); + Update_FX_feedback(Config.FX_Feedback); // Copy the actual pixels from the backup to the latest page for (i=0; iPages->Nb_layers;i++) @@ -1080,7 +1082,7 @@ void End_of_modification(void) Update_screen_targets(); #endif - Download_infos_backup(Main_backups); + Update_FX_feedback(Config.FX_Feedback); /* Last_backed_up_layers = 0; Backup(); diff --git a/pages.h b/pages.h index 09c3def6..d6f44ebe 100644 --- a/pages.h +++ b/pages.h @@ -27,6 +27,13 @@ #ifndef _PAGES_H_ #define _PAGES_H_ +/// +/// Pointer to the image to read, while drawing. It's either the last history +/// layer page when FX feedback is on, or the history page before it +/// when FX feedback is off. +extern byte * FX_feedback_screen; + + ////////////////////////////////////////////////////////////////////////// /////////////////////////// BACKUP /////////////////////////////////////// @@ -59,7 +66,6 @@ byte Merge_layer(); T_Page * New_page(byte nb_layers); void Download_infos_page_spare(T_Page * page); void Upload_infos_page_spare(T_Page * page); -void Download_infos_backup(T_List_of_pages * list); void Clear_page(T_Page * page); void Copy_S_page(T_Page * dest,T_Page * source); @@ -110,6 +116,10 @@ void Update_screen_targets(void); int Update_buffers(int width, int height); int Update_spare_buffers(int width, int height); void Redraw_spare_image(void); +/// +/// Must be called after changing the head of Main_backups list, or +/// Main_current_layer +void Update_FX_feedback(byte with_feedback); /// /// STATISTICS