Skip to content
Permalink
Browse files

tr_image.cpp: add R_Resize wrapper for ResampleTexture

  • Loading branch information...
illwieckz committed Mar 6, 2019
1 parent 64b0fce commit 7b76bfb7928efb471398d7574c3dc5261c84d14a
Showing with 24 additions and 0 deletions.
  1. +24 −0 src/engine/renderer/tr_image.cpp
@@ -1958,6 +1958,30 @@ static void R_Rotate( byte *in, int width, int height, int degrees )
ri.Hunk_FreeTempMemory( tmp );
}

/*
========
R_Resize
wrapper for ResampleTexture to help to resize a texture in place like this:
pic = R_Resize( pic, width, height, newWidth, newHeight );
please not resize normalmap with this, use ResampleTexture directly instead
========
*/

byte *R_Resize( byte *in, int width, int height, int newWidth, int newHeight )
{

byte *out;

out = (byte*) ri.Z_Malloc( newWidth * newHeight * 4 );
ResampleTexture( (unsigned int*) in, width, height, (unsigned int*) out, newWidth, newHeight, false );
ri.Free( in );

return out;
}

/*
===============
R_FindCubeImage

0 comments on commit 7b76bfb

Please sign in to comment.
You can’t perform that action at this time.