From f93aa1c4a5dc334a437ad8bc6c7ffa7a5417d19c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 19 Aug 2013 00:09:48 +0300 Subject: fix dye for big endian system again. --- src/resources/sdlimagehelper.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/resources/sdlimagehelper.cpp') diff --git a/src/resources/sdlimagehelper.cpp b/src/resources/sdlimagehelper.cpp index 678835edb..7cba9b0dc 100644 --- a/src/resources/sdlimagehelper.cpp +++ b/src/resources/sdlimagehelper.cpp @@ -53,10 +53,18 @@ Image *SDLImageHelper::load(SDL_RWops *const rw, Dye const &dye) const rgba.BytesPerPixel = 4; rgba.colorkey = 0; rgba.alpha = 255; - rgba.Rmask = 0xFF000000; rgba.Rloss = 0; rgba.Rshift = 24; - rgba.Gmask = 0x00FF0000; rgba.Gloss = 0; rgba.Gshift = 16; - rgba.Bmask = 0x0000FF00; rgba.Bloss = 0; rgba.Bshift = 8; - rgba.Amask = 0x000000FF; rgba.Aloss = 0; rgba.Ashift = 0; + +#if SDL_BYTEORDER == SDL_BIG_ENDIAN + rgba.Rmask = 0x000000FF; + rgba.Gmask = 0x0000FF00; + rgba.Bmask = 0x00FF0000; + rgba.Amask = 0xFF000000; +#else + rgba.Rmask = 0xFF000000; + rgba.Gmask = 0x00FF0000; + rgba.Bmask = 0x0000FF00; + rgba.Amask = 0x000000FF; +#endif SDL_Surface *const surf = SDL_ConvertSurface( tmpImage, &rgba, SDL_SWSURFACE); -- cgit v1.2.3-60-g2f50