X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Flibgame%2Fsdl.c;h=5dd81ef0eb04f5adcfa05c247215dac96d16ab85;hb=12d4953d364b0b185f7669e36c6d64adb29d742d;hp=48a3e374ec39f5a64796bee38fb02b072137ca9a;hpb=522cba3565ad60664933d454f83518961deb41c5;p=rocksndiamonds.git diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index 48a3e374..5dd81ef0 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -223,34 +223,7 @@ static boolean equalSDLPixelFormat(SDL_PixelFormat *format1, format1->BytesPerPixel == format2->BytesPerPixel && format1->Rmask == format2->Rmask && format1->Gmask == format2->Gmask && - format1->Bmask == format2->Bmask && - format1->Amask == format2->Amask); -} - -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; + format1->Bmask == format2->Bmask); } SDL_Surface *SDLGetNativeSurface(SDL_Surface *surface) @@ -279,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) @@ -431,7 +427,7 @@ void SDLInitVideoBuffer(boolean fullscreen) should never be drawn to directly, it would do no harm nevertheless. */ /* create additional (symbolic) buffer for double-buffering */ - ReCreateBitmap(&window, video.width, video.height, video.depth); + ReCreateBitmap(&window, video.width, video.height); } static boolean SDLCreateScreen(boolean fullscreen) @@ -924,7 +920,7 @@ void PrepareFadeBitmap(int draw_target) FinalizeScreen(draw_target); } -void SDLFadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height, +void SDLFadeRectangle(int x, int y, int width, int height, int fade_mode, int fade_delay, int post_delay, void (*draw_border_function)(void)) {