From: Holger Schemel Date: Tue, 31 May 2016 18:28:17 +0000 (+0200) Subject: fixed re-creating window-sized buffers only if window size has changed X-Git-Tag: 4.0.0.0-rc3~39 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=ac39e3a146d0d95f1738e33d21fd76612f09b093;p=rocksndiamonds.git fixed re-creating window-sized buffers only if window size has changed --- diff --git a/src/libgame/system.c b/src/libgame/system.c index 4e53f626..acd36018 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -201,23 +201,26 @@ void InitGfxDoor3Info(int ex, int ey, int exsize, int eysize) void InitGfxWindowInfo(int win_xsize, int win_ysize) { - gfx.win_xsize = win_xsize; - gfx.win_ysize = win_ysize; - - gfx.background_bitmap_mask = REDRAW_NONE; - - ReCreateBitmap(&gfx.background_bitmap, win_xsize, win_ysize, DEFAULT_DEPTH); + if (win_xsize != gfx.win_xsize || win_ysize != gfx.win_ysize) + { + ReCreateBitmap(&gfx.background_bitmap, win_xsize, win_ysize, DEFAULT_DEPTH); #if defined(TARGET_SDL2) - ReCreateBitmap(&gfx.final_screen_bitmap, win_xsize, win_ysize, DEFAULT_DEPTH); + ReCreateBitmap(&gfx.final_screen_bitmap, win_xsize, win_ysize, DEFAULT_DEPTH); #endif - ReCreateBitmap(&gfx.fade_bitmap_backup, win_xsize, win_ysize, DEFAULT_DEPTH); - ReCreateBitmap(&gfx.fade_bitmap_source, win_xsize, win_ysize, DEFAULT_DEPTH); - ReCreateBitmap(&gfx.fade_bitmap_target, win_xsize, win_ysize, DEFAULT_DEPTH); - ReCreateBitmap(&gfx.fade_bitmap_black, win_xsize, win_ysize, DEFAULT_DEPTH); + ReCreateBitmap(&gfx.fade_bitmap_backup, win_xsize, win_ysize, DEFAULT_DEPTH); + ReCreateBitmap(&gfx.fade_bitmap_source, win_xsize, win_ysize, DEFAULT_DEPTH); + ReCreateBitmap(&gfx.fade_bitmap_target, win_xsize, win_ysize, DEFAULT_DEPTH); + ReCreateBitmap(&gfx.fade_bitmap_black, win_xsize, win_ysize, DEFAULT_DEPTH); - ClearRectangle(gfx.fade_bitmap_black, 0, 0, win_xsize, win_ysize); + ClearRectangle(gfx.fade_bitmap_black, 0, 0, win_xsize, win_ysize); + } + + gfx.win_xsize = win_xsize; + gfx.win_ysize = win_ysize; + + gfx.background_bitmap_mask = REDRAW_NONE; } void InitGfxScrollbufferInfo(int scrollbuffer_width, int scrollbuffer_height)