]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - image.c
Tomaz fixed Image_CopyMux
[xonotic/darkplaces.git] / image.c
diff --git a/image.c b/image.c
index dfef91a24a508ab654e86e4dc7a3786d34b22048..f7cf892d4a2dcb453bd7fdaa6d8a1531222faadf 100644 (file)
--- a/image.c
+++ b/image.c
@@ -7,7 +7,7 @@
 int            image_width;
 int            image_height;
 
-#if 0
+#if 1
 // written by LordHavoc in a readable way, optimized by Vic, further optimized by LordHavoc (the non-special index case), readable version preserved below this
 void Image_CopyMux(qbyte *outpixels, const qbyte *inpixels, int inputwidth, int inputheight, qboolean inputflipx, qboolean inputflipy, qboolean inputflipdiagonal, int numoutputcomponents, int numinputcomponents, int *outputinputcomponentindices)
 {
@@ -32,7 +32,7 @@ void Image_CopyMux(qbyte *outpixels, const qbyte *inpixels, int inputwidth, int
                else
                {
                        for (y = 0, line = inpixels + row_ofs; y < inputheight; y++, line += row_inc)
-                               for (x = 0, in = line + col_ofs; x < inputwidth; x++, in += col_inc, outpixels += 3)
+                               for (x = 0, in = line + col_ofs; x < inputwidth; x++, in += col_inc, outpixels += numinputcomponents)
                                        for (c = 0; c < numoutputcomponents; c++)
                                                outpixels[c] = ((index = outputinputcomponentindices[c]) & 0x80000000) ? index : in[index];
                }
@@ -50,7 +50,7 @@ void Image_CopyMux(qbyte *outpixels, const qbyte *inpixels, int inputwidth, int
                else
                {
                        for (y = 0, line = inpixels + row_ofs; y < inputheight; y++, line += row_inc)
-                               for (x = 0, in = line + col_ofs; x < inputwidth; x++, in += col_inc, outpixels += 3)
+                               for (x = 0, in = line + col_ofs; x < inputwidth; x++, in += col_inc, outpixels += numinputcomponents)
                                        for (c = 0; c < numoutputcomponents; c++)
                                                outpixels[c] = in[outputinputcomponentindices[c]];
                }