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

index 73c42b68c023d0e57b72ce967e3935ceee5ac7be..5dd81ef0eb04f5adcfa05c247215dac96d16ab85 100644 (file)
@@ -226,32 +226,6 @@ static boolean equalSDLPixelFormat(SDL_PixelFormat *format1,
          format1->Bmask         == format2->Bmask);
 }
 
-boolean SDLSetNativeSurface(SDL_Surface **surface)
-{
-  SDL_Surface *new_surface;
-
-  if (surface == NULL ||
-      *surface == NULL ||
-      backbuffer == NULL ||
-      backbuffer->surface == NULL)
-    return FALSE;
-
-  // if pixel format already optimized for destination surface, do nothing
-  if (equalSDLPixelFormat((*surface)->format, backbuffer->surface->format))
-    return FALSE;
-
-  new_surface = SDL_ConvertSurface(*surface, backbuffer->surface->format, 0);
-
-  if (new_surface == NULL)
-    Error(ERR_EXIT, "SDL_ConvertSurface() failed: %s", SDL_GetError());
-
-  SDL_FreeSurface(*surface);
-
-  *surface = new_surface;
-
-  return TRUE;
-}
-
 SDL_Surface *SDLGetNativeSurface(SDL_Surface *surface)
 {
   SDL_PixelFormat format;
@@ -278,6 +252,29 @@ SDL_Surface *SDLGetNativeSurface(SDL_Surface *surface)
   return new_surface;
 }
 
+boolean SDLSetNativeSurface(SDL_Surface **surface)
+{
+  SDL_Surface *new_surface;
+
+  if (surface == NULL ||
+      *surface == NULL ||
+      backbuffer == NULL ||
+      backbuffer->surface == NULL)
+    return FALSE;
+
+  // if pixel format already optimized for destination surface, do nothing
+  if (equalSDLPixelFormat((*surface)->format, backbuffer->surface->format))
+    return FALSE;
+
+  new_surface = SDLGetNativeSurface(*surface);
+
+  SDL_FreeSurface(*surface);
+
+  *surface = new_surface;
+
+  return TRUE;
+}
+
 #else
 
 boolean SDLSetNativeSurface(SDL_Surface **surface)