Fix issue 495 : Contour fill crashes on new anim frame, and possibly random crashes when adding anim frames

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1968 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2012-07-10 23:03:29 +00:00
parent 86d67e4658
commit 2aa72730ad
2 changed files with 12 additions and 2 deletions

View File

@ -1243,7 +1243,7 @@ void Fill_general(byte fill_color)
(x_pos<=Limit_right) && (x_pos<=Limit_right) &&
(y_pos>=Limit_top) && (y_pos>=Limit_top) &&
(y_pos<=Limit_bottom) ) (y_pos<=Limit_bottom) )
Pixel_preview(x_pos,y_pos,~Screen_backup[x_pos+y_pos*Main_image_width]); Pixel_preview(x_pos,y_pos,~Main_screen[x_pos+y_pos*Main_image_width]);
} }

View File

@ -688,6 +688,16 @@ void Update_screen_targets(void)
else else
{ {
Main_screen=Main_backups->Pages->Image[Main_current_layer].Pixels; Main_screen=Main_backups->Pages->Image[Main_current_layer].Pixels;
// Sometimes this function will be called in situations where the
// current history step and previous one don't have as many layers.
// I don't like the idea of letting Screen_backup NULL or dangling,
// so in case Screen_backup was queried, it will point to a valid
// readable bitmap of correct size : current image.
if (Main_backups->Pages->Nb_layers != Main_backups->Pages->Next->Nb_layers
|| Main_backups->Pages->Width != Main_backups->Pages->Next->Width
|| Main_backups->Pages->Height != Main_backups->Pages->Next->Height)
Screen_backup=Main_screen;
else
Screen_backup=Main_backups->Pages->Next->Image[Main_current_layer].Pixels; Screen_backup=Main_backups->Pages->Next->Image[Main_current_layer].Pixels;
} }
Update_pixel_renderer(); Update_pixel_renderer();