Commit 800f9679 authored by Mukund Sivaraman's avatar Mukund Sivaraman

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.
parent b100b141
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment