summaryrefslogtreecommitdiff
path: root/src/resources/sdlimagehelper.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-08-17 01:30:01 +0300
committerAndrei Karas <akaras@inbox.ru>2017-08-17 01:30:01 +0300
commitf084a76075d63d70eff0a6fc198a475b2ea428f2 (patch)
treeb6d766abb8e04308aae086a951f074329daa7919 /src/resources/sdlimagehelper.cpp
parent23a9bf91fc75a208b62e8c8a3ce8e5e5bb42ef36 (diff)
downloadmanaverse-f084a76075d63d70eff0a6fc198a475b2ea428f2.tar.gz
manaverse-f084a76075d63d70eff0a6fc198a475b2ea428f2.tar.bz2
manaverse-f084a76075d63d70eff0a6fc198a475b2ea428f2.tar.xz
manaverse-f084a76075d63d70eff0a6fc198a475b2ea428f2.zip
Add missing image format fields into SDLImageHelper::load.
Diffstat (limited to 'src/resources/sdlimagehelper.cpp')
-rw-r--r--src/resources/sdlimagehelper.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/resources/sdlimagehelper.cpp b/src/resources/sdlimagehelper.cpp
index d3b6bdb83..5459062f9 100644
--- a/src/resources/sdlimagehelper.cpp
+++ b/src/resources/sdlimagehelper.cpp
@@ -72,22 +72,36 @@ Image *SDLImageHelper::load(SDL_RWops *const rw, Dye const &dye)
rgba.BytesPerPixel = 4;
rgba.colorkey = 0;
rgba.alpha = 255;
+ rgba.Rloss = 0;
+ rgba.Gloss = 0;
+ rgba.Bloss = 0;
+ rgba.Aloss = 0;
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
rgba.Rmask = 0x000000FF;
+ rgba.Rshift = 24;
rgba.Gmask = 0x0000FF00;
+ rgba.Gshift = 16;
rgba.Bmask = 0x00FF0000;
+ rgba.Bshift = 8;
rgba.Amask = 0xFF000000;
+ rgba.Ashift = 0;
#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
rgba.Rmask = 0xFF000000;
+ rgba.Rshift = 0;
rgba.Gmask = 0x00FF0000;
+ rgba.Gshift = 8;
rgba.Bmask = 0x0000FF00;
+ rgba.Bshift = 16;
rgba.Amask = 0x000000FF;
+ rgba.Ashift = 24;
#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
+ // +++ here is bug on ppc64le
SDL_Surface *const surf = MSDL_ConvertSurface(
tmpImage, &rgba, SDL_SWSURFACE);
+
MSDL_FreeSurface(tmpImage);
if (surf == nullptr)
return nullptr;