delet vid.buffer

unused memory allocation
This commit is contained in:
Alug committed 2025-09-27 16:26:32 +02:00
1 parent 104abe8531
commit ccff92dfbd
3 files changed
+2 -39

No files matched your search

-1
View File
@@ -42,7 +42,6 @@ INT32 VID_SetMode(INT32 modenum)
vid.modenum = 0;
vid.width = 320;
vid.height = 240;
vid.buffer = android_surface;
return 0;
}
-1
View File
@@ -57,7 +57,6 @@ typedef struct viddef_s
// screens[3] = fade screen start
// screens[4] = fade screen end, postimage tempoarary buffer
UINT8 *buffer; // invisible screens buffer
INT32 width; // PIXELS per scanline
INT32 height;
boolean recalc; // if true, recalc vid-based stuff
+2 -37
View File
@@ -200,7 +200,6 @@ static INT32 windowedModes[MAXWINMODES][2] =
static INT32 custom_width = 0;
static INT32 custom_height = 0;
static void Impl_VideoSetupBuffer(void);
static SDL_bool Impl_CreateWindow(SDL_bool fullscreen);
static void Impl_SetWindowIcon(void);
@@ -1315,12 +1314,6 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
}
texture = SDL_CreateTexture(renderer, sw_texture_format, SDL_TEXTUREACCESS_STREAMING, width, height);
if (vid.buffer)
{
free(vid.buffer);
vid.buffer = NULL;
}
}
}
@@ -1426,7 +1419,7 @@ void I_UpdateNoVsync(void)
void I_ReadScreen(UINT8 * restrict scr, INT32 scale)
{
if (rendermode != render_soft)
I_Error ("I_ReadScreen: called while in non-software mode");
I_Error("I_ReadScreen: called while in non-software mode");
else if (scale == 1)
VID_BlitLinearScreen(vid.screens[0], scr, vid.width, vid.height, vid.width, vid.width);
else
@@ -1575,7 +1568,6 @@ INT32 VID_SetMode(INT32 modeNum)
}
SDLSetMode(vid.width, vid.height, USE_FULLSCREEN);
Impl_VideoSetupBuffer();
src_rect.w = vid.width;
src_rect.h = vid.height;
@@ -1706,24 +1698,6 @@ static void Impl_SetWindowIcon(void)
SDL_SetWindowIcon(window, icoSurface);
}
static void Impl_VideoSetupBuffer(void)
{
// Set up game's software render buffer
size_t size;
if (vid.buffer)
free(vid.buffer);
size = vid.width*vid.height * NUMSCREENS;
vid.buffer = calloc(size, NUMSCREENS);
if (!vid.buffer)
{
I_Error("%s", M_GetText("Not enough memory for video buffer\n"));
}
}
static FILE * OpenRendererFile(const char * mode)
{
char * path = va(pandf,srb2home,"renderer.txt");
@@ -1884,7 +1858,6 @@ void I_StartupGraphics(void)
if (a2c)
fputs("a2c\n", file);
#endif
fclose(file);
}
else
@@ -1943,21 +1916,12 @@ void I_StartupGraphics(void)
void I_ShutdownGraphics(void)
{
const rendermode_t oldrendermode = rendermode;
rendermode = render_none;
if (icoSurface)
SDL_FreeSurface(icoSurface);
icoSurface = NULL;
if (oldrendermode == render_soft)
{
if (vid.buffer)
free(vid.buffer);
vid.buffer = NULL;
}
I_OutputMsg("I_ShutdownGraphics(): ");
// was graphics initialized anyway?
@@ -1976,6 +1940,7 @@ void I_ShutdownGraphics(void)
SDL_GL_DeleteContext(sdlglcontext);
}
#endif
SDL_QuitSubSystem(SDL_INIT_VIDEO);
framebuffer = SDL_FALSE;
}