Fix important bug where resizing an image or using any transformation resets transparent color to zero

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1610 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2010-09-12 14:58:25 +00:00
parent 79dbd3722a
commit c53c6415c3
2 changed files with 12 additions and 3 deletions

View File

@ -340,7 +340,10 @@ int L_GetBackupPixel(lua_State* L)
lua_pushinteger(L, Main_backups->Pages->Transparent_color); lua_pushinteger(L, Main_backups->Pages->Transparent_color);
return 1; 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; return 1;
} }

View File

@ -833,11 +833,17 @@ int Backup_with_new_dimensions(int upload,byte layers,int width,int height)
return 0; return 0;
} }
Upload_infos_page_main(new_page); 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->Filename, Main_backups->Pages->Filename);
strcpy(new_page->File_directory, Main_backups->Pages->File_directory); strcpy(new_page->File_directory, Main_backups->Pages->File_directory);
new_page->Gradients=Dup_gradient(upload?Main_backups->Pages:NULL); 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)) if (Create_new_page(new_page,Main_backups,0xFFFFFFFF))
{ {
for (i=0; i<layers;i++) for (i=0; i<layers;i++)