From f084a76075d63d70eff0a6fc198a475b2ea428f2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 17 Aug 2017 01:30:01 +0300 Subject: Add missing image format fields into SDLImageHelper::load. --- src/resources/sdlimagehelper.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/resources') 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; -- cgit v1.2.3-70-g09d2