- implement normalNx scaling

# Conflicts:
#	wadsrc/static/menudef.txt
This commit is contained in:
Rachael Alexanderson 2018-09-23 07:53:20 -04:00 committed by drfrag666
parent c1f0335bb4
commit f06501da22
3 changed files with 37 additions and 2 deletions

View file

@ -50,7 +50,7 @@
CUSTOM_CVAR(Int, gl_texture_hqresize, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{
if (self < 0 || self > 16)
if (self < 0 || self > 19)
{
self = 0;
}
@ -190,6 +190,30 @@ static void scale4x ( uint32_t* inputBuffer, uint32_t* outputBuffer, int inWidth
delete[] buffer2x;
}
#define DEFINENORMALSCALER(NAME, SIZE) \
static void NAME ( uint32_t* inputBuffer, uint32_t* outputBuffer, int inWidth, int inHeight ) \
{ \
const int width = SIZE * inWidth; \
const int height = SIZE * inHeight; \
\
for ( int i = 0; i < inWidth; ++i ) \
{ \
for ( int j = 0; j < inHeight; ++j ) \
{ \
const uint32_t E = inputBuffer[ i +inWidth*j ]; \
for ( int k = 0; k < SIZE; k++ ) \
{ \
for ( int l = 0; l < SIZE; l++ ) \
{ \
outputBuffer[SIZE*i+k + width*(SIZE*j+l)] = E; \
} \
} \
} \
} \
}
DEFINENORMALSCALER(normal2x, 2)
DEFINENORMALSCALER(normal3x, 3)
DEFINENORMALSCALER(normal4x, 4)
static unsigned char *scaleNxHelper( void (*scaleNxFunction) ( uint32_t* , uint32_t* , int , int),
const int N,
@ -397,7 +421,12 @@ unsigned char *gl_CreateUpsampledTextureBuffer ( const FTexture *inputTexture, u
case 14:
case 15:
return xbrzHelper(xbrzOldScale, type - 11, inputBuffer, inWidth, inHeight, outWidth, outHeight );
case 16:
return scaleNxHelper( &normal2x, 2, inputBuffer, inWidth, inHeight, outWidth, outHeight );
case 17:
return scaleNxHelper( &normal3x, 3, inputBuffer, inWidth, inHeight, outWidth, outHeight );
case 18:
return scaleNxHelper( &normal4x, 4, inputBuffer, inWidth, inHeight, outWidth, outHeight );
}
}
return inputBuffer;

View file

@ -2856,6 +2856,9 @@ OPTVAL_ROUND = "Round";
OPTVAL_SCALE2X = "Scale2x";
OPTVAL_SCALE3X = "Scale3x";
OPTVAL_SCALE4X = "Scale4x";
OPTVAL_NORMAL2X = "Normal2x";
OPTVAL_NORMAL3X = "Normal3x";
OPTVAL_NORMAL4X = "Normal4x";
OPTVAL_HQ2X = "hq2x";
OPTVAL_HQ3X = "hq3x";
OPTVAL_HQ4X = "hq4x";

View file

@ -2188,6 +2188,9 @@ OptionValue "HqResizeModes"
13, "$OPTVAL_OLD_2XBRZ"
14, "$OPTVAL_OLD_3XBRZ"
15, "$OPTVAL_OLD_4XBRZ"
16, "$OPTVAL_NORMAL2X"
17, "$OPTVAL_NORMAL3X"
18, "$OPTVAL_NORMAL4X"
}
OptionValue "HqResizeModesNoMMX"