Browse Source

Resize PalSurface when resizing the game window

pull/3691/head
staphen 4 years ago committed by Gleb Mazovetskiy
parent
commit
f897f5fd92
  1. 9
      Source/dx.cpp
  2. 1
      Source/dx.h
  3. 2
      Source/utils/display.cpp

9
Source/dx.cpp

@ -92,8 +92,6 @@ void CreateBackBuffer()
// time the global `palette` is changed. No need to do anything here as
// the global `palette` doesn't have any colors set yet.
#endif
pal_surface_palette_version = 1;
}
void LockBufPriv()
@ -144,6 +142,7 @@ void dx_init()
palette_init();
CreateBackBuffer();
pal_surface_palette_version = 1;
}
void lock_buf(int idx) // NOLINT(misc-unused-parameters)
@ -219,6 +218,12 @@ void dx_reinit()
force_redraw = 255;
}
void dx_resize()
{
CreateBackBuffer();
force_redraw = 255;
}
void InitPalette()
{
Palette = SDLWrap::AllocPalette();

1
Source/dx.h

@ -19,6 +19,7 @@ void lock_buf(int idx);
void unlock_buf(int idx);
void dx_cleanup();
void dx_reinit();
void dx_resize();
void InitPalette();
void BltFast(SDL_Rect *srcRect, SDL_Rect *dstRect);
void Blit(SDL_Surface *src, SDL_Rect *srcRect, SDL_Rect *dstRect);

2
Source/utils/display.cpp

@ -17,6 +17,7 @@
#include "controls/devices/joystick.h"
#include "controls/devices/kbcontroller.h"
#include "controls/game_controls.h"
#include "dx.h"
#include "options.h"
#include "utils/log.hpp"
#include "utils/sdl_wrap.h"
@ -321,6 +322,7 @@ void ResizeWindow()
#endif
ReinitializeRenderer();
dx_resize();
}
SDL_Surface *GetOutputSurface()

Loading…
Cancel
Save