From: Holger Schemel Date: Mon, 27 Jun 2016 05:20:08 +0000 (+0200) Subject: changed setting native surface to use internal conversion function (SDL1) X-Git-Tag: 4.0.0.0~63 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=b4a4b3e959ada7bae876a4a9d78f534e320a7b41;p=rocksndiamonds.git changed setting native surface to use internal conversion function (SDL1) --- diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index 5dd81ef0..4b44daa1 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -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)