Changeset - r14116:0d5bf6e8511e
[Not reviewed]
master
0 1 0
peter1138 - 15 years ago 2009-12-31 07:39:05
peter1138@openttd.org
(svn r18673) -Fix (r17943): Deja vu: 3 byte structs are padded to a word on ARM.
1 file changed with 4 insertions and 10 deletions:
0 comments (0 inline, 0 general)
src/screenshot.cpp
Show inline comments
 
@@ -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 *nam
 
				/* 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 */
0 comments (0 inline, 0 general)