Keep rect in memory

Feel better about this than creating one all da time
This commit is contained in:
Sally Coolatta 2022-03-26 17:16:13 -04:00 committed by Eidolon
parent 40b021d6e4
commit 41997c4549

View file

@ -1179,6 +1179,10 @@ void I_UpdateNoBlit(void)
static inline boolean I_SkipFrame(void)
{
#if 1
// While I fixed the FPS counter bugging out with this,
// I actually really like being able to pause and
// use perfstats to measure rendering performance
// without game logic changes.
return false;
#else
static boolean skip = false;
@ -1203,6 +1207,8 @@ static inline boolean I_SkipFrame(void)
//
// I_FinishUpdate
//
static SDL_Rect src_rect = { 0, 0, 0, 0 };
void I_FinishUpdate(void)
{
if (rendermode == render_none)
@ -1228,27 +1234,22 @@ void I_FinishUpdate(void)
if (rendermode == render_soft && screens[0])
{
SDL_Rect rect;
rect.x = 0;
rect.y = 0;
rect.w = vid.width;
rect.h = vid.height;
if (!bufSurface) //Double-Check
{
Impl_VideoSetupSDLBuffer();
}
if (bufSurface)
{
SDL_BlitSurface(bufSurface, NULL, vidSurface, &rect);
SDL_BlitSurface(bufSurface, &src_rect, vidSurface, &src_rect);
// Fury -- there's no way around UpdateTexture, the GL backend uses it anyway
SDL_LockSurface(vidSurface);
SDL_UpdateTexture(texture, &rect, vidSurface->pixels, vidSurface->pitch);
SDL_UpdateTexture(texture, &src_rect, vidSurface->pixels, vidSurface->pitch);
SDL_UnlockSurface(vidSurface);
}
SDL_RenderClear(renderer);
SDL_RenderCopy(renderer, texture, NULL, NULL);
SDL_RenderCopy(renderer, texture, &src_rect, NULL);
SDL_RenderPresent(renderer);
}
#ifdef HWRENDER
@ -1257,6 +1258,7 @@ void I_FinishUpdate(void)
OglSdlFinishUpdate(cv_vidwait.value);
}
#endif
exposevideo = SDL_FALSE;
}
@ -1610,6 +1612,9 @@ INT32 VID_SetMode(INT32 modeNum)
vid.modenum = modeNum;
//Impl_SetWindowName("SRB2 "VERSIONSTRING);
src_rect.w = vid.width;
src_rect.h = vid.height;
VID_CheckRenderer();
return SDL_TRUE;
}