fixed re-creating window-sized buffers only if window size has changed
authorHolger Schemel <info@artsoft.org>
Tue, 31 May 2016 18:28:17 +0000 (20:28 +0200)
committerHolger Schemel <info@artsoft.org>
Tue, 31 May 2016 18:28:17 +0000 (20:28 +0200)
src/libgame/system.c

index 4e53f626d624d0676dcb88bff81a9873be2aa0ef..acd36018b2614036196301205967ab4e581f6e5b 100644 (file)
@@ -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)