[Patch] vid.buffer
This commit is contained in:
parent
39e17bce4b
commit
7efc3adf6f
3 changed files with 10 additions and 38 deletions
|
|
@ -61,7 +61,6 @@ struct viddef_t
|
|||
// screens[3] = fade screen start
|
||||
// screens[4] = fade screen end, postimage tempoarary buffer
|
||||
|
||||
UINT8 *buffer; // invisible screens buffer
|
||||
size_t rowbytes; // bytes per scanline of the VIDEO mode
|
||||
INT32 width; // PIXELS per scanline
|
||||
INT32 height;
|
||||
|
|
|
|||
|
|
@ -142,8 +142,6 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen);
|
|||
|
||||
static void Impl_VideoSetupSurfaces(int width, int height);
|
||||
|
||||
static void Impl_SetupSoftwareBuffer(void);
|
||||
|
||||
static void Impl_InitOpenGL(void);
|
||||
|
||||
#if defined(HAVE_IMAGE)
|
||||
|
|
@ -305,28 +303,6 @@ static void Impl_VideoSetupSurfaces(int width, int height)
|
|||
texture = SDL_CreateTexture(renderer, sw_texture_format, SDL_TEXTUREACCESS_STREAMING, width, height);
|
||||
}
|
||||
|
||||
static void Impl_SetupSoftwareBuffer(void)
|
||||
{
|
||||
// Set up game's software render buffer
|
||||
size_t size;
|
||||
|
||||
vid.rowbytes = vid.width;
|
||||
|
||||
free(vid.buffer);
|
||||
|
||||
size = vid.rowbytes*vid.height * NUMSCREENS;
|
||||
vid.buffer = static_cast<UINT8*>(malloc(size));
|
||||
|
||||
if (vid.buffer)
|
||||
{
|
||||
// Clear the buffer
|
||||
// HACK: Wasn't sure where else to put this.
|
||||
memset(vid.buffer, 31, size);
|
||||
}
|
||||
else
|
||||
I_Error("%s", M_GetText("Not enough memory for video buffer\n"));
|
||||
}
|
||||
|
||||
static SDL_Rect src_rect = { 0, 0, 0, 0 };
|
||||
|
||||
static SDL_bool SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen, SDL_bool reposition)
|
||||
|
|
@ -380,12 +356,6 @@ static SDL_bool SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen, SDL_b
|
|||
if (Impl_RenderContextReset() == SDL_FALSE)
|
||||
I_Error("Couldn't create or reset rendering context");
|
||||
|
||||
if (vid.buffer)
|
||||
{
|
||||
free(vid.buffer);
|
||||
vid.buffer = NULL;
|
||||
}
|
||||
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1514,7 +1484,7 @@ boolean VID_CheckRenderer(void)
|
|||
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
Impl_SetupSoftwareBuffer();
|
||||
vid.rowbytes = vid.width;
|
||||
SCR_SetDrawFuncs();
|
||||
}
|
||||
#ifdef HWRENDER
|
||||
|
|
@ -1822,9 +1792,6 @@ void I_ShutdownGraphics(void)
|
|||
icoSurface = NULL;
|
||||
#endif
|
||||
|
||||
free(vid.buffer);
|
||||
vid.buffer = NULL;
|
||||
|
||||
rendermode = render_none;
|
||||
|
||||
I_OutputMsg("I_ShutdownGraphics(): ");
|
||||
|
|
|
|||
|
|
@ -3882,17 +3882,23 @@ UINT8 GetColorLUTDirect(colorlookup_t *lut, UINT8 r, UINT8 g, UINT8 b)
|
|||
void V_Init(void)
|
||||
{
|
||||
INT32 i;
|
||||
UINT8 *base = vid.buffer;
|
||||
const INT32 screensize = vid.rowbytes * vid.height;
|
||||
|
||||
for (i = 0; i < NUMSCREENS; i++)
|
||||
{
|
||||
if (vid.screens[i])
|
||||
free(vid.screens[i]);
|
||||
vid.screens[i] = NULL;
|
||||
}
|
||||
|
||||
// start address of NUMSCREENS * width*height vidbuffers
|
||||
if (base)
|
||||
if (screensize > 0)
|
||||
{
|
||||
for (i = 0; i < NUMSCREENS; i++)
|
||||
vid.screens[i] = base + i*screensize;
|
||||
{
|
||||
vid.screens[i] = malloc(screensize);
|
||||
memset(vid.screens[i], 0, screensize);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
|
|||
Loading…
Reference in a new issue