file-bmp: Fix order of data in RGBA_8888 images

See #678250, #678252, etc. for example bug reports.

This fix should be sufficient in fixing BMP output, but it looks
like some apps like Firefox have broken BMP loaders which do not
care for the masks. We would have to change the masks for them.
This commit is contained in:
Mukund Sivaraman 2012-09-21 20:11:31 +05:30
parent b100b14111
commit 800f967930
1 changed files with 3 additions and 3 deletions

View File

@ -602,20 +602,20 @@ write_image (FILE *f,
Write (f, buf, 3);
break;
case RGBX_8888:
buf[0] = 0;
buf[3] = *temp++;
buf[2] = *temp++;
buf[1] = *temp++;
buf[0] = 0;
xpos++;
if (channels > 3 && (guchar) *temp == 0)
buf[0] = buf[1] = buf[2] = 0xff;
Write (f, buf, 4);
break;
case RGBA_8888:
buf[3] = *temp++;
buf[2] = *temp++;
buf[1] = *temp++;
buf[0] = *temp++;
buf[3] = *temp;
buf[0] = *temp;
xpos++;
Write (f, buf, 4);
break;