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 1e479577eb106c0ddddc36bc4a20f790da2b273a..72bbc14abe3df5abee36b2aeac94943cdfd3ff7b 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",