Lua: Fix clipping for getbackuppixel

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1612 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2010-09-12 17:35:20 +00:00
parent 499c9bc943
commit 32f85909ef

View File

@ -345,10 +345,10 @@ int L_GetBackupPixel(lua_State* L)
LUA_ARG_NUMBER(2, "getbackuppixel", y, INT_MIN, INT_MAX);
// Bound check
if (x<0 || y<0 || x>=Main_image_width || y>=Main_image_height)
if (x<0 || y<0 || x>=Main_backups->Pages->Next->Width || y>=Main_backups->Pages->Next->Height)
{
// Silently return the image's transparent color
lua_pushinteger(L, Main_backups->Pages->Transparent_color);
lua_pushinteger(L, Main_backups->Pages->Next->Transparent_color);
return 1;
}
// Can't use Read_pixel_from_backup_screen(), because in a Lua script