changed setting native surface to use internal conversion function (SDL1)
authorHolger Schemel <info@artsoft.org>
Mon, 27 Jun 2016 05:20:08 +0000 (07:20 +0200)
committerHolger Schemel <info@artsoft.org>
Mon, 27 Jun 2016 05:20:08 +0000 (07:20 +0200)
src/libgame/sdl.c

index 5dd81ef0eb04f5adcfa05c247215dac96d16ab85..4b44daa1c53d6ce82c6c59f62cc134800b671d61 100644 (file)
@@ -277,31 +277,13 @@ boolean SDLSetNativeSurface(SDL_Surface **surface)
 
 #else
 
-boolean SDLSetNativeSurface(SDL_Surface **surface)
-{
-  SDL_Surface *new_surface;
-
-  if (surface == NULL ||
-      *surface == NULL ||
-      !video.initialized)
-    return FALSE;
-
-  new_surface = SDL_DisplayFormat(*surface);
-
-  if (new_surface == NULL)
-    Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
-
-  SDL_FreeSurface(*surface);
-
-  *surface = new_surface;
-
-  return TRUE;
-}
-
 SDL_Surface *SDLGetNativeSurface(SDL_Surface *surface)
 {
   SDL_Surface *new_surface;
 
+  if (surface == NULL)
+    return NULL;
+
   if (video.initialized)
     new_surface = SDL_DisplayFormat(surface);
   else
@@ -315,6 +297,24 @@ SDL_Surface *SDLGetNativeSurface(SDL_Surface *surface)
   return new_surface;
 }
 
+boolean SDLSetNativeSurface(SDL_Surface **surface)
+{
+  SDL_Surface *new_surface;
+
+  if (surface == NULL ||
+      *surface == NULL ||
+      !video.initialized)
+    return FALSE;
+
+  new_surface = SDLGetNativeSurface(*surface);
+
+  SDL_FreeSurface(*surface);
+
+  *surface = new_surface;
+
+  return TRUE;
+}
+
 #endif
 
 #if defined(TARGET_SDL2)