Fix crashing bug when using pipette on a software-zoomed video mode from the palette menu. Fixes issue 196. Warning! Version 2.0 needs a new build!

git-svn-id: svn://pulkomandy.tk/GrafX2/branches/release@951 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2009-07-24 08:34:20 +00:00
parent 164b538725
commit d47e40b7cb

View File

@ -1835,26 +1835,20 @@ short Wait_click_in_palette(T_Palette_button * button)
// -------------- Récupération d'une couleur derrière un menu ----------------
void Get_color_behind_window(byte * color, byte * click)
{
short width=Window_width*Menu_factor_X;
short height=Window_height*Menu_factor_Y;
short old_x=-1;
short old_y=-1;
short index;
short a,b,c,d; // Variables temporaires et multitâches...
byte * buffer;
byte * buffer = NULL;
char str[25];
byte cursor_was_hidden;
if ((buffer=(byte *) malloc(width*height)))
{
Hide_cursor();
cursor_was_hidden=Cursor_hidden;
Cursor_hidden=0;
for (index=0; index<height; index++)
Read_line(Window_pos_X,Window_pos_Y+index,width,buffer+((int)index*width*Pixel_width));
Save_background(&buffer,Window_pos_X,Window_pos_Y,Window_width,Window_height);
a=Menu_Y;
Menu_Y=Menu_Y_before_window;
b=Menu_is_visible;
@ -1924,20 +1918,12 @@ void Get_color_behind_window(byte * color, byte * click)
Hide_cursor();
}
for (index=0; index<height; index++)
Display_line(Window_pos_X,Window_pos_Y+index,width,buffer+((int)index*width));
Restore_background(buffer,Window_pos_X,Window_pos_Y,Window_width,Window_height);
Update_rect(Window_pos_X, Window_pos_Y, Window_width*Menu_factor_X, Window_height*Menu_factor_Y);
Cursor_shape=CURSOR_SHAPE_ARROW;
Paintbrush_hidden=b;
Cursor_hidden=cursor_was_hidden;
Display_cursor();
free(buffer);
}
else
{
Error(0);
}
}