mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-17 21:25:40 +00:00
(svn r17909) -Fix: 32bpp BMP screenshots were in wrong colours on big endian machines
This commit is contained in:
parent
ee2d790b34
commit
86c40a17a9
@ -143,6 +143,15 @@ static bool MakeBmpImage(char *name, ScreenshotCallback *callb, void *userdata,
|
|||||||
/* render the pixels */
|
/* render the pixels */
|
||||||
callb(userdata, buff, h, padw, n);
|
callb(userdata, buff, h, padw, n);
|
||||||
|
|
||||||
|
#if TTD_ENDIAN == TTD_BIG_ENDIAN
|
||||||
|
if (pixelformat == 32) {
|
||||||
|
/* Data stored in BMP are always little endian,
|
||||||
|
* but we have big endian data in buffer */
|
||||||
|
uint32 *buff32 = (uint32 *)buff;
|
||||||
|
for (i = 0; i < padw * n; i++) buff32[i] = BSWAP32(buff32[i]);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* write each line */
|
/* write each line */
|
||||||
while (n)
|
while (n)
|
||||||
if (fwrite(buff + (--n) * padw * bpp, padw * bpp, 1, f) != 1) {
|
if (fwrite(buff + (--n) * padw * bpp, padw * bpp, 1, f) != 1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user