mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-10 07:12:03 +00:00
SDL: in the SDL 2.0 interface code, we use a fake surface as our vidsurface, so we should be freeing it
This commit is contained in:
parent
70a72baabc
commit
a529dca69f
2 changed files with 11 additions and 8 deletions
|
@ -372,7 +372,7 @@ else
|
|||
|
||||
# build a normal optimised version
|
||||
WINDRESFLAGS = -DNDEBUG
|
||||
CFLAGS+=-O2
|
||||
#CFLAGS+=-O2
|
||||
endif
|
||||
CFLAGS+=-g $(OPTS) $(M5) $(WINDRESFLAGS)
|
||||
|
||||
|
|
|
@ -251,6 +251,11 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
|
|||
{
|
||||
SDL_FreeSurface(vidSurface);
|
||||
}
|
||||
if (vid.buffer)
|
||||
{
|
||||
free(vid.buffer);
|
||||
vid.buffer = NULL;
|
||||
}
|
||||
SDL_PixelFormatEnumToMasks(sw_texture_format, &bpp, &rmask, &gmask, &bmask, &amask);
|
||||
vidSurface = SDL_CreateRGBSurface(0, width, height, bpp, rmask, gmask, bmask, amask);
|
||||
}
|
||||
|
@ -1654,12 +1659,10 @@ static void Impl_VideoSetupBuffer(void)
|
|||
{
|
||||
vid.rowbytes = vid.width * vid.bpp;
|
||||
vid.direct = NULL;
|
||||
vid.buffer = malloc(vid.rowbytes*vid.height*NUMSCREENS);
|
||||
if (vid.buffer)
|
||||
{
|
||||
memset(vid.buffer,0x00,vid.rowbytes*vid.height*NUMSCREENS);
|
||||
}
|
||||
else
|
||||
free(vid.buffer);
|
||||
vid.buffer = calloc(vid.rowbytes*vid.height, NUMSCREENS);
|
||||
if (!vid.buffer)
|
||||
{
|
||||
I_Error("%s", M_GetText("Not enough memory for video buffer\n"));
|
||||
}
|
||||
|
@ -1766,7 +1769,6 @@ void I_StartupGraphics(void)
|
|||
//Impl_SetWindowName("SRB2 "VERSIONSTRING);
|
||||
VID_SetMode(VID_GetModeForSize(BASEVIDWIDTH, BASEVIDHEIGHT));
|
||||
|
||||
vid.buffer = NULL; // For software mode
|
||||
vid.width = BASEVIDWIDTH; // Default size for startup
|
||||
vid.height = BASEVIDHEIGHT; // BitsPerPixel is the SDL interface's
|
||||
vid.recalc = true; // Set up the console stufff
|
||||
|
@ -1816,7 +1818,8 @@ void I_ShutdownGraphics(void)
|
|||
icoSurface = NULL;
|
||||
if (render_soft == oldrendermode)
|
||||
{
|
||||
vidSurface = NULL; //Alam: SDL_Video system free vidSurface for me
|
||||
if (vidSurface) SDL_FreeSurface(vidSurface);
|
||||
vidSurface = NULL;
|
||||
if (vid.buffer) free(vid.buffer);
|
||||
vid.buffer = NULL;
|
||||
if (bufSurface) SDL_FreeSurface(bufSurface);
|
||||
|
|
Loading…
Reference in a new issue