Fixed stupid bug making the zoom drift to bottom right corner of the picture.

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1292 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2010-02-01 19:31:32 +00:00
parent 56785bd94e
commit 59f2c45c43

View File

@ -1743,8 +1743,8 @@ void Change_magnifier_factor(byte factor_index)
// Values that need to be computed before switching to the new zoom factor
if (Cursor_in_menu || !Main_magnifier_mode)
{
center_x=Main_magnifier_offset_X+(Main_magnifier_width>>1);
center_y=Main_magnifier_offset_Y+(Main_magnifier_height>>1);
center_x = Main_magnifier_offset_X + (Main_magnifier_width / 2);
center_y = Main_magnifier_offset_Y + (Main_magnifier_height / 2);
} else {
// Zoom to cursor
center_x = (Paintbrush_X - Main_magnifier_offset_X) / (float)Main_magnifier_width;
@ -1763,8 +1763,8 @@ void Change_magnifier_factor(byte factor_index)
Main_magnifier_offset_X=center_x-(Main_magnifier_width>>1);
Main_magnifier_offset_Y=center_y-(Main_magnifier_height>>1);
} else {
Main_magnifier_offset_X = Paintbrush_X - center_x * Main_magnifier_width / 65536 ;
Main_magnifier_offset_Y = Paintbrush_Y - center_y * Main_magnifier_height / 65536 ;
Main_magnifier_offset_X = Paintbrush_X - center_x * Main_magnifier_width ;
Main_magnifier_offset_Y = Paintbrush_Y - center_y * Main_magnifier_height ;
}
// Correction en cas de débordement de l'image
if (Main_magnifier_offset_X+Main_magnifier_width>Main_image_width)