1
0
Fork 0

(svn r16628) -Codechange: remove one gcc2 hack

release/1.0
smatz 2009-06-22 23:15:27 +00:00
parent 4f0e62deb6
commit d703f0c3b5
5 changed files with 16 additions and 17 deletions

View File

@ -97,7 +97,7 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
uint m = *src_n; uint m = *src_n;
/* In case the m-channel is zero, do not remap this pixel in any way */ /* In case the m-channel is zero, do not remap this pixel in any way */
if (m == 0) { if (m == 0) {
*dst = *src_px; *dst = src_px->data;
*anim = 0; *anim = 0;
} else { } else {
uint r = remap[m]; uint r = remap[m];
@ -161,7 +161,7 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
uint m = *src_n++; uint m = *src_n++;
/* Above 217 (PALETTE_ANIM_SIZE_START) is palette animation */ /* Above 217 (PALETTE_ANIM_SIZE_START) is palette animation */
*anim++ = m; *anim++ = m;
*dst++ = (m >= PALETTE_ANIM_SIZE_START) ? this->LookupColourInPalette(m) : *src_px; *dst++ = (m >= PALETTE_ANIM_SIZE_START) ? this->LookupColourInPalette(m) : src_px->data;
src_px++; src_px++;
} while (--n != 0); } while (--n != 0);
} else { } else {

View File

@ -41,7 +41,7 @@ public:
*/ */
static inline uint32 LookupColourInPalette(uint index) static inline uint32 LookupColourInPalette(uint index)
{ {
return _cur_palette[index]; return _cur_palette[index].data;
} }
/** /**

View File

@ -110,7 +110,7 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
uint m = *src_n; uint m = *src_n;
/* In case the m-channel is zero, do not remap this pixel in any way */ /* In case the m-channel is zero, do not remap this pixel in any way */
if (m == 0) { if (m == 0) {
*dst = *src_px; *dst = src_px->data;
} else { } else {
uint r = remap[m]; uint r = remap[m];
if (r != 0) *dst = this->LookupColourInPalette(r); if (r != 0) *dst = this->LookupColourInPalette(r);
@ -162,7 +162,9 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
/* faster than memcpy(), n is usually low */ /* faster than memcpy(), n is usually low */
src_n += n; src_n += n;
do { do {
*dst++ = *src_px++; *dst = src_px->data;
dst++;
src_px++;
} while (--n != 0); } while (--n != 0);
} else { } else {
src_n += n; src_n += n;

View File

@ -138,14 +138,15 @@ struct DrawPixelInfo {
}; };
/** Structure to access the alpha, red, green, and blue channels from a 32 bit number. */ /** Structure to access the alpha, red, green, and blue channels from a 32 bit number. */
struct Colour { union Colour {
uint32 data; ///< Conversion of the channel information to a 32 bit number.
struct {
#if TTD_ENDIAN == TTD_BIG_ENDIAN #if TTD_ENDIAN == TTD_BIG_ENDIAN
uint8 a, r, g, b; ///< colour channels in BE order uint8 a, r, g, b; ///< colour channels in BE order
#else #else
uint8 b, g, r, a; ///< colour channels in LE order uint8 b, g, r, a; ///< colour channels in LE order
#endif /* TTD_ENDIAN == TTD_BIG_ENDIAN */ #endif /* TTD_ENDIAN == TTD_BIG_ENDIAN */
};
operator uint32 () const { return *(uint32 *)this; } ///< Conversion of the channel information to a 32 bit number.
}; };
/** Available font sizes */ /** Available font sizes */

View File

@ -4,16 +4,12 @@
#include "../core/endian_type.hpp" #include "../core/endian_type.hpp"
#if TTD_ENDIAN == TTD_BIG_ENDIAN #define M(r, g, b) { 0xff << 24 | (r) << 16 | (g) << 8 | (b) }
#define M(r, g, b) { 0xff, r, g, b }
#else
#define M(r, g, b) { b, g, r, 0xff }
#endif /* TTD_ENDIAN == TTD_BIG_ENDIAN */
static const Colour _palettes[][256] = { static const Colour _palettes[][256] = {
/* palette 0 (mixed TTD DOS + TTD Windows palette */ /* palette 0 (mixed TTD DOS + TTD Windows palette */
{ {
{ 0, 0, 0, 0 }, M( 16, 16, 16), M( 32, 32, 32), M( 48, 48, 48), { 0}, M( 16, 16, 16), M( 32, 32, 32), M( 48, 48, 48),
M( 65, 64, 65), M( 82, 80, 82), M( 98, 101, 98), M(115, 117, 115), M( 65, 64, 65), M( 82, 80, 82), M( 98, 101, 98), M(115, 117, 115),
M(131, 133, 131), M(148, 149, 148), M(168, 168, 168), M(184, 184, 184), M(131, 133, 131), M(148, 149, 148), M(168, 168, 168), M(184, 184, 184),
M(200, 200, 200), M(216, 216, 216), M(232, 232, 232), M(252, 252, 252), M(200, 200, 200), M(216, 216, 216), M(232, 232, 232), M(252, 252, 252),
@ -81,7 +77,7 @@ static const Colour _palettes[][256] = {
/* palette 1 (TTD Windows) */ /* palette 1 (TTD Windows) */
{ {
{ 0, 0, 0, 0 }, M(212, 0, 212), M(212, 0, 212), M(212, 0, 212), { 0}, M(212, 0, 212), M(212, 0, 212), M(212, 0, 212),
M(212, 0, 212), M(212, 0, 212), M(212, 0, 212), M(212, 0, 212), M(212, 0, 212), M(212, 0, 212), M(212, 0, 212), M(212, 0, 212),
M(212, 0, 212), M(212, 0, 212), M(168, 168, 168), M(184, 184, 184), M(212, 0, 212), M(212, 0, 212), M(168, 168, 168), M(184, 184, 184),
M(200, 200, 200), M(216, 216, 216), M(232, 232, 232), M(252, 252, 252), M(200, 200, 200), M(216, 216, 216), M(232, 232, 232), M(252, 252, 252),