fixed converting surfaces with alpha channel for SDL 1.2
authorHolger Schemel <info@artsoft.org>
Mon, 27 Jun 2016 23:36:58 +0000 (01:36 +0200)
committerHolger Schemel <info@artsoft.org>
Mon, 27 Jun 2016 23:36:58 +0000 (01:36 +0200)
src/libgame/sdl.c

index 1e47957..72bbc14 100644 (file)
@@ -340,10 +340,12 @@ SDL_Surface *SDLGetNativeSurface(SDL_Surface *surface)
   if (surface == NULL)
     return NULL;
 
-  if (video.initialized)
-    new_surface = SDL_DisplayFormat(surface);
-  else
+  if (!video.initialized)
     new_surface = SDL_ConvertSurface(surface, surface->format, SURFACE_FLAGS);
+  else if (SDLHasAlpha(surface))
+    new_surface = SDL_DisplayFormatAlpha(surface);
+  else
+    new_surface = SDL_DisplayFormat(surface);
 
   if (new_surface == NULL)
     Error(ERR_EXIT, "%s() failed: %s",