X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsdl.c;h=04cfc0e739fbafa9ca8df4b92d94609e601ec28c;hb=05682009143b836eb4b031b707995132cab8c957;hp=1184acd84a4b227af94424e920b8b201bdb42344;hpb=f73405762b7a66ebed17c0f6fa56e909d7e5626f;p=rocksndiamonds.git diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index 1184acd8..04cfc0e7 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -273,7 +273,7 @@ static void SDLSetWindowIcon(char *basename) if ((surface = IMG_Load(filename)) == NULL) { - Error(ERR_WARN, "IMG_Load() failed: %s", SDL_GetError()); + Error(ERR_WARN, "IMG_Load('%s') failed: %s", basename, SDL_GetError()); return; } @@ -353,6 +353,11 @@ SDL_Surface *SDLGetNativeSurface(SDL_Surface *surface) if (new_surface == NULL) Error(ERR_EXIT, "SDL_ConvertSurface() failed: %s", SDL_GetError()); + // workaround for a bug in SDL 2.0.12 (which does not convert the color key) + if (SDLHasColorKey(surface) && !SDLHasColorKey(new_surface)) + SDL_SetColorKey(new_surface, SET_TRANSPARENT_PIXEL, + SDLGetColorKey(surface)); + return new_surface; } @@ -2239,7 +2244,8 @@ Bitmap *SDLLoadImage(char *filename) // load image to temporary surface if ((sdl_image_tmp = IMG_Load(filename)) == NULL) - Error(ERR_EXIT, "IMG_Load() failed: %s", SDL_GetError()); + Error(ERR_EXIT, "IMG_Load('%s') failed: %s", getBaseNamePtr(filename), + SDL_GetError()); print_timestamp_time("IMG_Load"); @@ -2523,7 +2529,7 @@ static void setJoystickButton(int nr, int button_id_raw, int button_state) void HandleJoystickEvent(Event *event) { - switch(event->type) + switch (event->type) { case SDL_CONTROLLERDEVICEADDED: #if DEBUG_JOYSTICKS