From 32f85909efb38242894470ca1e623c85a8ac8514 Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Sun, 12 Sep 2010 17:35:20 +0000 Subject: [PATCH] Lua: Fix clipping for getbackuppixel git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1612 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- src/factory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/factory.c b/src/factory.c index 29ba97db..239b9312 100644 --- a/src/factory.c +++ b/src/factory.c @@ -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