diff --git a/src/gl/textures/gl_hqresize.cpp b/src/gl/textures/gl_hqresize.cpp index b09617b4c..54312b398 100644 --- a/src/gl/textures/gl_hqresize.cpp +++ b/src/gl/textures/gl_hqresize.cpp @@ -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; diff --git a/wadsrc/static/language.enu b/wadsrc/static/language.enu index 8db016d4d..f907abd62 100644 --- a/wadsrc/static/language.enu +++ b/wadsrc/static/language.enu @@ -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"; diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index a694b06bf..cd920ea18 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -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"