summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2009-12-31 07:39:05 +0000
committerpeter1138 <peter1138@openttd.org>2009-12-31 07:39:05 +0000
commit2d14ced236388a69e80a5031c359d7f1f912a0d1 (patch)
tree0435bab55fed79f9e12125127af89579ae2f94c3
parent768bfa969d0b68c53f8ef7b8ef8855bc819a555e (diff)
downloadopenttd-2d14ced236388a69e80a5031c359d7f1f912a0d1.tar.xz
(svn r18673) -Fix (r17943): Deja vu: 3 byte structs are padded to a word on ARM.
-rw-r--r--src/screenshot.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/screenshot.cpp b/src/screenshot.cpp
index 5ef812695..49662e6ce 100644
--- a/src/screenshot.cpp
+++ b/src/screenshot.cpp
@@ -78,12 +78,6 @@ struct RgbQuad {
};
assert_compile(sizeof(RgbQuad) == 4);
-/** Pixel data in 24bpp BMP */
-struct RgbTriplet {
- byte b, g, r;
-};
-assert_compile(sizeof(RgbTriplet) == 3);
-
/**
* Generic .BMP writer
* @param name file name including extension
@@ -182,11 +176,11 @@ static bool MakeBMPImage(const char *name, ScreenshotCallback *callb, void *user
/* Convert from 'native' 32bpp to BMP-like 24bpp.
* Works for both big and little endian machines */
Colour *src = ((Colour *)buff) + n * w;
- RgbTriplet *dst = (RgbTriplet *)line;
+ byte *dst = line;
for (uint i = 0; i < w; i++) {
- dst[i].r = src[i].r;
- dst[i].g = src[i].g;
- dst[i].b = src[i].b;
+ dst[i * 3 ] = src[i].b;
+ dst[i * 3 + 1] = src[i].g;
+ dst[i * 3 + 2] = src[i].r;
}
}
/* Write to file */