summaryrefslogtreecommitdiff
path: root/src/resources/sdlimagehelper.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-08-19 00:09:48 +0300
committerAndrei Karas <akaras@inbox.ru>2013-08-19 12:14:51 +0300
commitf93aa1c4a5dc334a437ad8bc6c7ffa7a5417d19c (patch)
treec0a296616c53c29864e3e234f3332f2251108f97 /src/resources/sdlimagehelper.cpp
parent01a29fe1c2d464a79b0bf5c8d3d2760e3cc83817 (diff)
downloadmanaverse-f93aa1c4a5dc334a437ad8bc6c7ffa7a5417d19c.tar.gz
manaverse-f93aa1c4a5dc334a437ad8bc6c7ffa7a5417d19c.tar.bz2
manaverse-f93aa1c4a5dc334a437ad8bc6c7ffa7a5417d19c.tar.xz
manaverse-f93aa1c4a5dc334a437ad8bc6c7ffa7a5417d19c.zip
fix dye for big endian system again.
Diffstat (limited to 'src/resources/sdlimagehelper.cpp')
-rw-r--r--src/resources/sdlimagehelper.cpp16
1 files changed, 12 insertions, 4 deletions
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);