Fix issue 377: getbackuppixel doesn't work after image resize

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1611 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud
2010-09-12 17:15:16 +00:00
parent c53c6415c3
commit 499c9bc943
6 changed files with 177 additions and 50 deletions

View File

@@ -247,12 +247,23 @@ int L_SetPictureSize(lua_State* L)
int w;
int h;
int nb_args=lua_gettop(L);
int i;
LUA_ARG_LIMIT (2, "setpicturesize");
LUA_ARG_NUMBER(1, "setpicturesize", w, 1, 9999);
LUA_ARG_NUMBER(2, "setpicturesize", h, 1, 9999);
Resize_image(w, h); // TODO: a return value to catch runtime errors
Backup_in_place(w, h);
// part of Resize_image() : the pixel copy part.
for (i=0; i<Main_backups->Pages->Nb_layers; i++)
{
Copy_part_of_image_to_another(
Main_backups->Pages->Next->Image[i],0,0,Min(Main_backups->Pages->Next->Width,Main_image_width),
Min(Main_backups->Pages->Next->Height,Main_image_height),Main_backups->Pages->Next->Width,
Main_backups->Pages->Image[i],0,0,Main_image_width);
}
Redraw_layered_image();
return 0;
}