Only calculate vfx every other row to try to improve performance

This commit is contained in:
fickleheart 2019-04-09 23:00:39 -05:00
parent fe3cd967d1
commit 15bb586c57

View file

@ -1219,8 +1219,8 @@ void V_DrawVhsEffect(boolean rewind)
static fixed_t upbary = 100, downbary = 150; static fixed_t upbary = 100, downbary = 150;
UINT8 *buf = screens[0], *tmp = screens[4]; UINT8 *buf = screens[0], *tmp = screens[4];
UINT16 x, y; UINT16 y;
UINT32 pos = 0; UINT32 x, pos = 0;
UINT8 *normalmapstart = ((UINT8 *)transtables + (8<<FF_TRANSSHIFT|(19<<8))); UINT8 *normalmapstart = ((UINT8 *)transtables + (8<<FF_TRANSSHIFT|(19<<8)));
#ifdef HQ_VHS #ifdef HQ_VHS
@ -1241,7 +1241,7 @@ void V_DrawVhsEffect(boolean rewind)
if (upbary < -barsize) upbary = vid.height; if (upbary < -barsize) upbary = vid.height;
if (downbary > vid.height) downbary = -barsize; if (downbary > vid.height) downbary = -barsize;
for (y = 0; y < vid.height; y++) for (y = 0; y < vid.height; y+=2)
{ {
thismapstart = normalmapstart; thismapstart = normalmapstart;
offs = 0; offs = 0;
@ -1260,9 +1260,9 @@ void V_DrawVhsEffect(boolean rewind)
// lazy way to avoid crashes // lazy way to avoid crashes
if (y == 0 && offs < 0) offs = 0; if (y == 0 && offs < 0) offs = 0;
else if (y == vid.height-1 && offs > 0) offs = 0; else if (y >= vid.height-2 && offs > 0) offs = 0;
for (x = 0; x < vid.rowbytes; x++, pos++) for (x = pos+vid.rowbytes*2; pos < x; pos++)
{ {
tmp[pos] = thismapstart[buf[pos+offs]]; tmp[pos] = thismapstart[buf[pos+offs]];
#ifdef HQ_VHS #ifdef HQ_VHS