diff options
author | Max Horn | 2003-04-26 11:02:49 +0000 |
---|---|---|
committer | Max Horn | 2003-04-26 11:02:49 +0000 |
commit | b617227723bc578f064e98d4fba5e289fdd8cbdc (patch) | |
tree | 46c382122f3021fc234597c799af066224748a3a /scumm/smush | |
parent | 8b8c52c06e5d2aceefc2e4462bf558ecf6f29511 (diff) | |
download | scummvm-rg350-b617227723bc578f064e98d4fba5e289fdd8cbdc.tar.gz scummvm-rg350-b617227723bc578f064e98d4fba5e289fdd8cbdc.tar.bz2 scummvm-rg350-b617227723bc578f064e98d4fba5e289fdd8cbdc.zip |
fixed endian regression (introduced by the alignment changes)
svn-id: r7127
Diffstat (limited to 'scumm/smush')
-rw-r--r-- | scumm/smush/codec47.cpp | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/scumm/smush/codec47.cpp b/scumm/smush/codec47.cpp index 2213b86f42..6561e8d702 100644 --- a/scumm/smush/codec47.cpp +++ b/scumm/smush/codec47.cpp @@ -28,19 +28,18 @@ #define COPY_4X1_LINE(dst, src) \ do { \ - int j; \ - for(j=0; j<4; j++) \ - (dst)[j] = (src)[j]; \ + (dst)[0] = (src)[0]; \ + (dst)[1] = (src)[1]; \ + (dst)[2] = (src)[2]; \ + (dst)[3] = (src)[3]; \ } while(0) #define COPY_2X1_LINE(dst, src) \ do { \ - int j; \ - for(j=0; j<2; j++) \ - (dst)[j] = (src)[j]; \ + (dst)[0] = (src)[0]; \ + (dst)[1] = (src)[1]; \ } while(0) - #else /* SCUMM_NEED_ALIGNMENT */ #define COPY_4X1_LINE(dst, src) \ @@ -51,6 +50,20 @@ #endif +#define FILL_4X1_LINE(dst, val) \ + do { \ + (dst)[0] = val; \ + (dst)[1] = val; \ + (dst)[2] = val; \ + (dst)[3] = val; \ + } while(0) + +#define FILL_2X1_LINE(dst, val) \ + do { \ + (dst)[0] = val; \ + (dst)[1] = val; \ + } while(0) + static int32 codec37_table[] = { 0, 1, 2, 3, 3, 3, 3, 2, 1, 0, 0, 0, @@ -488,18 +501,16 @@ void Codec47Decoder::level3(byte *d_dst) { _d_src += 4; } else if (code == 0xFE) { byte t = *_d_src++; - tmp = t | t << 8; - COPY_2X1_LINE(d_dst, (unsigned char*)&tmp); - COPY_2X1_LINE(d_dst + _d_pitch, (unsigned char*)&tmp); + FILL_2X1_LINE(d_dst, t); + FILL_2X1_LINE(d_dst + _d_pitch, t); } else if (code == 0xFC) { tmp = _offset2; COPY_2X1_LINE(d_dst, d_dst + tmp); COPY_2X1_LINE(d_dst + _d_pitch, d_dst + _d_pitch + tmp); } else { byte t = _paramPtr[code]; - tmp = t | t << 8; - COPY_2X1_LINE(d_dst, (unsigned char*)&tmp); - COPY_2X1_LINE(d_dst + _d_pitch, (unsigned char*)&tmp); + FILL_2X1_LINE(d_dst, t); + FILL_2X1_LINE(d_dst + _d_pitch, t); } } @@ -526,9 +537,8 @@ void Codec47Decoder::level2(byte *d_dst) { d_dst = tmp_dst; } else if (code == 0xFE) { byte t = *_d_src++; - uint32 val = t << 24 | t << 16 | t << 8 | t; for (i = 0; i < 4; i++) { - COPY_4X1_LINE(d_dst, (unsigned char*)&val); + FILL_4X1_LINE(d_dst, t); d_dst += _d_pitch; } } else if (code == 0xFD) { @@ -555,9 +565,8 @@ void Codec47Decoder::level2(byte *d_dst) { } } else { byte t = _paramPtr[code]; - uint32 val = t << 24 | t << 16 | t << 8 | t; for (i = 0; i < 4; i++) { - COPY_4X1_LINE(d_dst, (unsigned char*)&val); + FILL_4X1_LINE(d_dst, t); d_dst += _d_pitch; } } @@ -587,10 +596,9 @@ void Codec47Decoder::level1(byte *d_dst) { d_dst = tmp_dst; } else if (code == 0xFE) { byte t = *_d_src++; - int32 val = t << 24 | t << 16 | t << 8 | t; for (i = 0; i < 8; i++) { - COPY_4X1_LINE(d_dst, (unsigned char*)&val); - COPY_4X1_LINE(d_dst + 4, (unsigned char*)&val); + FILL_4X1_LINE(d_dst, t); + FILL_4X1_LINE(d_dst + 4, t); d_dst += _d_pitch; } } else if (code == 0xFD) { @@ -619,10 +627,9 @@ void Codec47Decoder::level1(byte *d_dst) { } } else { byte t = _paramPtr[code]; - int32 val = t << 24 | t << 16 | t << 8 | t; for (i = 0; i < 8; i++) { - COPY_4X1_LINE(d_dst, (unsigned char*)&val); - COPY_4X1_LINE(d_dst + 4, (unsigned char*)&val); + FILL_4X1_LINE(d_dst, t); + FILL_4X1_LINE(d_dst + 4, t); d_dst += _d_pitch; } } |