]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
renamed most Image_CopyMux parameters to begin with input to clarify their purpose...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 15 May 2004 19:35:15 +0000 (19:35 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 15 May 2004 19:35:15 +0000 (19:35 +0000)
cleaned up Image_CopyMux, and fixed its handling of inputflipdiagonal to properly work with unequal inputwidth/inputheight
swapped Image_CopyMux numinputcomponents/numoutputcomponents parameters to be more consistent with the 'output, input' order of its other parameters

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4168 d7cf8633-e32d-0410-b094-e92efae38249

image.c
image.h

diff --git a/image.c b/image.c
index 2d3882c9c0cb44c6a17012779df67140aef5b8ba..a52ff45392e3ca7b12030733a79348ab927aa560 100644 (file)
--- a/image.c
+++ b/image.c
@@ -7,21 +7,21 @@
 int            image_width;
 int            image_height;
 
-void Image_CopyMux(qbyte *outpixels, const qbyte *inpixels, int width, int height, int flipx, int flipy, int flipdiagonal, int numincomponents, int numoutcomponents, int *inputcomponentindices)
+void Image_CopyMux(qbyte *outpixels, const qbyte *inpixels, int inputwidth, int inputheight, qboolean inputflipx, qboolean inputflipy, qboolean inputflipdiagonal, int numoutputcomponents, int numinputcomponents, int *outputinputcomponentindices)
 {
        int index, c, x, y;
        const qbyte *in, *inrow, *incolumn;
-       if (flipdiagonal)
+       if (inputflipdiagonal)
        {
-               for (y = 0;y < height;y++)
+               for (x = 0;x < inputwidth;x++)
                {
-                       incolumn = inpixels + (flipx ? width - 1 - y : y) * numincomponents;
-                       for (x = 0;x < width;x++)
+                       incolumn = inpixels + (inputflipx ? inputwidth - 1 - x : x) * numinputcomponents;
+                       for (y = 0;y < inputheight;y++)
                        {
-                               in = incolumn + (flipy ? height - 1 - x : x) * width * numincomponents;
-                               for (c = 0;c < numoutcomponents;c++)
+                               in = incolumn + (inputflipy ? inputheight - 1 - y : y) * inputwidth * numinputcomponents;
+                               for (c = 0;c < numoutputcomponents;c++)
                                {
-                                       index = inputcomponentindices[c];
+                                       index = outputinputcomponentindices[c];
                                        *outpixels++ = (index & 0x80000000) ? (index - 0x8000000) : in[index];
                                }
                        }
@@ -29,15 +29,15 @@ void Image_CopyMux(qbyte *outpixels, const qbyte *inpixels, int width, int heigh
        }
        else
        {
-               for (y = 0;y < height;y++)
+               for (y = 0;y < inputheight;y++)
                {
-                       inrow = inpixels + (flipy ? height - 1 - y : y) * width * numincomponents;
-                       for (x = 0;x < width;x++)
+                       inrow = inpixels + (inputflipy ? inputheight - 1 - y : y) * inputwidth * numinputcomponents;
+                       for (x = 0;x < inputwidth;x++)
                        {
-                               in = inrow + (flipx ? width - 1 - x : x) * numincomponents;
-                               for (c = 0;c < numoutcomponents;c++)
+                               in = inrow + (inputflipx ? inputwidth - 1 - x : x) * numinputcomponents;
+                               for (c = 0;c < numoutputcomponents;c++)
                                {
-                                       index = inputcomponentindices[c];
+                                       index = outputinputcomponentindices[c];
                                        *outpixels++ = (index & 0x80000000) ? (index - 0x8000000) : in[index];
                                }
                        }
diff --git a/image.h b/image.h
index 08b21f0fbd25dbbd907c37289d363c0e54d99b32..e3f144cb6a3ebd452655bffa164ed820021940be 100644 (file)
--- a/image.h
+++ b/image.h
@@ -4,9 +4,9 @@
 
 // swizzle components (even converting number of components) and flip images
 // (warning: input must be different than output due to non-linear read/write)
-// (tip: inputcomponentindices can contain values | 0x80000000 to tell it to
+// (tip: component indices can contain values | 0x80000000 to tell it to
 // store them directly into output, so 255 | 0x80000000 would write 255)
-void Image_CopyMux(qbyte *outpixels, const qbyte *inpixels, int width, int height, int flipx, int flipy, int flipdiagonal, int numincomponents, int numoutcomponents, int *inputcomponentindices);
+void Image_CopyMux(qbyte *outpixels, const qbyte *inpixels, int inputwidth, int inputheight, qboolean inputflipx, qboolean inputflipy, qboolean inputflipdiagonal, int numoutputcomponents, int numinputcomponents, int *outputinputcomponentindices);
 
 // applies gamma correction to RGB pixels, in can be the same as out
 void Image_GammaRemapRGB(const qbyte *in, qbyte *out, int pixels, const qbyte *gammar, const qbyte *gammag, const qbyte *gammab);