fix the RGB ordering of dumped textures

This commit is contained in:
zeromus 2009-02-14 22:24:45 +00:00
parent 7ad6fc5257
commit 842b39d1a6
1 changed files with 9 additions and 1 deletions

View File

@ -788,7 +788,15 @@ int NDS_WriteBMP_32bppBuffer(int width, int height, const void* buf, const char
elems_written += fwrite(&imageheader, 1, sizeof(imageheader), file);
for(int i=0;i<height;i++)
elems_written += fwrite((u8*)buf + (height-i-1)*width*4,1,imageheader.width*4,file);
for(int x=0;x<width;x++)
{
u8* pixel = (u8*)buf + (height-i-1)*width*4;
pixel += (x*4);
fwrite(pixel+2,1,1,file);
fwrite(pixel +1,1,1,file);
fwrite(pixel +0,1,1,file);
fwrite(pixel +3,1,1,file);
}
fclose(file);
return 1;