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