fixed using unsupported rendering mode from config file with SDL1 target
authorHolger Schemel <info@artsoft.org>
Fri, 22 Apr 2016 17:48:44 +0000 (19:48 +0200)
committerHolger Schemel <info@artsoft.org>
Fri, 22 Apr 2016 17:48:44 +0000 (19:48 +0200)
src/libgame/sdl.c
src/libgame/sdl.h

index 913205aaa6d5893a1cc6150519feec18a6ec6057..d1406e8bcb5dff7fdfab840cd8d2346e7dd92949 100644 (file)
@@ -385,13 +385,8 @@ void SDLInitVideoBuffer(boolean fullscreen)
 {
   video.window_scaling_percent = setup.window_scaling_percent;
   video.window_scaling_quality = setup.window_scaling_quality;
-  video.screen_rendering_mode =
-    (strEqual(setup.screen_rendering_mode, STR_SPECIAL_RENDERING_BITMAP) ?
-     SPECIAL_RENDERING_BITMAP :
-     strEqual(setup.screen_rendering_mode, STR_SPECIAL_RENDERING_TARGET) ?
-     SPECIAL_RENDERING_TARGET:
-     strEqual(setup.screen_rendering_mode, STR_SPECIAL_RENDERING_DOUBLE) ?
-     SPECIAL_RENDERING_DOUBLE : SPECIAL_RENDERING_OFF);
+
+  SDLSetScreenRenderingMode(setup.screen_rendering_mode);
 
 #if defined(TARGET_SDL2)
   // SDL 2.0: support for (desktop) fullscreen mode available
@@ -640,13 +635,8 @@ boolean SDLSetVideoMode(boolean fullscreen)
       video.fullscreen_enabled = FALSE;
       video.window_scaling_percent = setup.window_scaling_percent;
       video.window_scaling_quality = setup.window_scaling_quality;
-      video.screen_rendering_mode =
-       (strEqual(setup.screen_rendering_mode, STR_SPECIAL_RENDERING_BITMAP) ?
-        SPECIAL_RENDERING_BITMAP :
-        strEqual(setup.screen_rendering_mode, STR_SPECIAL_RENDERING_TARGET) ?
-        SPECIAL_RENDERING_TARGET:
-        strEqual(setup.screen_rendering_mode, STR_SPECIAL_RENDERING_DOUBLE) ?
-        SPECIAL_RENDERING_DOUBLE : SPECIAL_RENDERING_OFF);
+
+      SDLSetScreenRenderingMode(setup.screen_rendering_mode);
     }
   }
 
@@ -757,17 +747,6 @@ void SDLSetWindowScalingQuality(char *window_scaling_quality)
   video.window_scaling_quality = window_scaling_quality;
 }
 
-void SDLSetScreenRenderingMode(char *screen_rendering_mode)
-{
-  video.screen_rendering_mode =
-    (strEqual(screen_rendering_mode, STR_SPECIAL_RENDERING_BITMAP) ?
-     SPECIAL_RENDERING_BITMAP :
-     strEqual(screen_rendering_mode, STR_SPECIAL_RENDERING_TARGET) ?
-     SPECIAL_RENDERING_TARGET:
-     strEqual(screen_rendering_mode, STR_SPECIAL_RENDERING_DOUBLE) ?
-     SPECIAL_RENDERING_DOUBLE : SPECIAL_RENDERING_OFF);
-}
-
 void SDLSetWindowFullscreen(boolean fullscreen)
 {
   if (sdl_window == NULL)
@@ -790,6 +769,21 @@ void SDLSetWindowFullscreen(boolean fullscreen)
 }
 #endif
 
+void SDLSetScreenRenderingMode(char *screen_rendering_mode)
+{
+#if defined(TARGET_SDL2)
+  video.screen_rendering_mode =
+    (strEqual(screen_rendering_mode, STR_SPECIAL_RENDERING_BITMAP) ?
+     SPECIAL_RENDERING_BITMAP :
+     strEqual(screen_rendering_mode, STR_SPECIAL_RENDERING_TARGET) ?
+     SPECIAL_RENDERING_TARGET:
+     strEqual(screen_rendering_mode, STR_SPECIAL_RENDERING_DOUBLE) ?
+     SPECIAL_RENDERING_DOUBLE : SPECIAL_RENDERING_OFF);
+#else
+  video.screen_rendering_mode = SPECIAL_RENDERING_BITMAP;
+#endif
+}
+
 void SDLRedrawWindow()
 {
   UpdateScreen_WithoutFrameDelay(NULL);
index bad3037cde3668a2e2722b0c22115856b4fbb13a..2402ca522a159ab2c72ce404cf38a2e8fb9cb4b7 100644 (file)
@@ -437,12 +437,11 @@ void SDLFreeBitmapTextures(Bitmap *);
 SDL_Surface *SDL_DisplayFormat(SDL_Surface *);
 void SDLSetWindowScaling(int);
 void SDLSetWindowScalingQuality(char *);
-void SDLSetScreenRenderingMode(char *);
 void SDLSetWindowFullscreen(boolean);
 #endif
 
+void SDLSetScreenRenderingMode(char *);
 void SDLRedrawWindow();
-
 void SDLSetWindowTitle(void);
 
 void SDLLimitScreenUpdates(boolean);