]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/texmanip.cpp
Merge commit 'e876e8ef487eeb9123f4906373622ffe3b6ea9d4' into master-merge
[xonotic/netradiant.git] / radiant / texmanip.cpp
index 1c6752521f41f97aeab29cfb4e5d574417b71c19..03196c3cd30c9da23978ca60cfabab06a8bd31bb 100644 (file)
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "stdafx.h"
-#include "str.h"
+#include "texmanip.h"
+
+#include <stdlib.h>
+#include "stream/textstream.h"
 
 static byte *row1 = NULL, *row2 = NULL;
 static int rowsize = 0;
 
-void R_ResampleTextureLerpLine( byte *in, byte *out, int inwidth, int outwidth, int bytesperpixel ){
+void R_ResampleTextureLerpLine( const byte *in, byte *out, int inwidth, int outwidth, int bytesperpixel ){
        int j, xi, oldx = 0, f, fstep, endx, lerp;
 #define LERPBYTE( i ) out[i] = (byte) ( ( ( ( row2[i] - row1[i] ) * lerp ) >> 16 ) + row1[i] )
 
@@ -89,8 +91,9 @@ void R_ResampleTextureLerpLine( byte *in, byte *out, int inwidth, int outwidth,
                        }
                }
        }
-       else{
-               Sys_Printf( "R_ResampleTextureLerpLine: unsupported bytesperpixel %i\n", bytesperpixel );
+       else
+       {
+               globalOutputStream() << "R_ResampleTextureLerpLine: unsupported bytesperpixel " << bytesperpixel << "\n";
        }
 }
 
@@ -99,7 +102,7 @@ void R_ResampleTextureLerpLine( byte *in, byte *out, int inwidth, int outwidth,
    R_ResampleTexture
    ================
  */
-void R_ResampleTexture( void *indata, int inwidth, int inheight, void *outdata,  int outwidth, int outheight, int bytesperpixel ){
+void R_ResampleTexture( const void *indata, int inwidth, int inheight, void *outdata,  int outwidth, int outheight, int bytesperpixel ){
        if ( rowsize < outwidth * bytesperpixel ) {
                if ( row1 ) {
                        free( row1 );
@@ -115,7 +118,7 @@ void R_ResampleTexture( void *indata, int inwidth, int inheight, void *outdata,
 
        if ( bytesperpixel == 4 ) {
                int i, j, yi, oldy, f, fstep, lerp, endy = ( inheight - 1 ), inwidth4 = inwidth * 4, outwidth4 = outwidth * 4;
-               byte    *inrow, *out;
+               byte *inrow, *out;
                out = (byte *)outdata;
                fstep = (int) ( inheight * 65536.0f / outheight );
 #define LERPBYTE( i ) out[i] = (byte) ( ( ( ( row2[i] - row1[i] ) * lerp ) >> 16 ) + row1[i] )
@@ -210,7 +213,7 @@ void R_ResampleTexture( void *indata, int inwidth, int inheight, void *outdata,
        }
        else if ( bytesperpixel == 3 ) {
                int i, j, yi, oldy, f, fstep, lerp, endy = ( inheight - 1 ), inwidth3 = inwidth * 3, outwidth3 = outwidth * 3;
-               byte    *inrow, *out;
+               byte *inrow, *out;
                out = (byte *)outdata;
                fstep = (int) ( inheight * 65536.0f / outheight );
 #define LERPBYTE( i ) out[i] = (byte) ( ( ( ( row2[i] - row1[i] ) * lerp ) >> 16 ) + row1[i] )
@@ -295,8 +298,9 @@ void R_ResampleTexture( void *indata, int inwidth, int inheight, void *outdata,
                        }
                }
        }
-       else{
-               Sys_Printf( "R_ResampleTexture: unsupported bytesperpixel %i\n", bytesperpixel );
+       else
+       {
+               globalOutputStream() << "R_ResampleTexture: unsupported bytesperpixel " << bytesperpixel << "\n";
        }
 }
 
@@ -361,8 +365,9 @@ void GL_MipReduce( byte *in, byte *out, int width, int height, int destwidth, in
                                in += nextrow; // skip a line
                        }
                }
-               else{
-                       Sys_Printf( "GL_MipReduce: desired size already achieved\n" );
+               else
+               {
+                       globalOutputStream() << "GL_MipReduce: desired size already achieved\n";
                }
        }
 }