diff --git a/src/factory.c b/src/factory.c index d70a0056..3d123400 100644 --- a/src/factory.c +++ b/src/factory.c @@ -340,7 +340,10 @@ int L_GetBackupPixel(lua_State* L) lua_pushinteger(L, Main_backups->Pages->Transparent_color); return 1; } - lua_pushinteger(L, Read_pixel_from_backup_screen(x,y)); + // Can't use Read_pixel_from_backup_screen(), because in a Lua script + // the "backup" can use a different screen dimension. + lua_pushinteger(L, *(Screen_backup + x + Main_backups->Pages->Next->Width * y)); + return 1; } diff --git a/src/pages.c b/src/pages.c index 9712488d..33421c29 100644 --- a/src/pages.c +++ b/src/pages.c @@ -833,11 +833,17 @@ int Backup_with_new_dimensions(int upload,byte layers,int width,int height) return 0; } Upload_infos_page_main(new_page); - new_page->Width=width; - new_page->Height=height; + + // Other data not covered by Upload_infos_page_main. + // I dunno really why we don't use Copy_S_Page strcpy(new_page->Filename, Main_backups->Pages->Filename); strcpy(new_page->File_directory, Main_backups->Pages->File_directory); new_page->Gradients=Dup_gradient(upload?Main_backups->Pages:NULL); + new_page->Background_transparent=Main_backups->Pages->Background_transparent; + new_page->Transparent_color=Main_backups->Pages->Transparent_color; + // + new_page->Width=width; + new_page->Height=height; if (Create_new_page(new_page,Main_backups,0xFFFFFFFF)) { for (i=0; i