]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - image.c
improved shadowmap side culling
[xonotic/darkplaces.git] / image.c
diff --git a/image.c b/image.c
index 2a2245152adeaf4d22ea9a0bc30216c1d000883e..d5123408c96141dd56849b2e5b29bc0321c53407 100644 (file)
--- a/image.c
+++ b/image.c
@@ -26,14 +26,14 @@ void Image_CopyMux(unsigned char *outpixels, const unsigned char *inpixels, int
                if (inputflipdiagonal)
                {
                        for (x = 0, line = inpixels + col_ofs; x < inputwidth; x++, line += col_inc)
-                               for (y = 0, in = line + row_ofs; y < inputheight; y++, in += row_inc, outpixels += numinputcomponents)
+                               for (y = 0, in = line + row_ofs; y < inputheight; y++, in += row_inc, outpixels += numoutputcomponents)
                                        for (c = 0; c < numoutputcomponents; c++)
                                                outpixels[c] = ((index = outputinputcomponentindices[c]) & 0x80000000) ? index : in[index];
                }
                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 += numinputcomponents)
+                               for (x = 0, in = line + col_ofs; x < inputwidth; x++, in += col_inc, outpixels += numoutputcomponents)
                                        for (c = 0; c < numoutputcomponents; c++)
                                                outpixels[c] = ((index = outputinputcomponentindices[c]) & 0x80000000) ? index : in[index];
                }
@@ -44,14 +44,14 @@ void Image_CopyMux(unsigned char *outpixels, const unsigned char *inpixels, int
                if (inputflipdiagonal)
                {
                        for (x = 0, line = inpixels + col_ofs; x < inputwidth; x++, line += col_inc)
-                               for (y = 0, in = line + row_ofs; y < inputheight; y++, in += row_inc, outpixels += numinputcomponents)
+                               for (y = 0, in = line + row_ofs; y < inputheight; y++, in += row_inc, outpixels += numoutputcomponents)
                                        for (c = 0; c < numoutputcomponents; c++)
                                                outpixels[c] = in[outputinputcomponentindices[c]];
                }
                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 += numinputcomponents)
+                               for (x = 0, in = line + col_ofs; x < inputwidth; x++, in += col_inc, outpixels += numoutputcomponents)
                                        for (c = 0; c < numoutputcomponents; c++)
                                                outpixels[c] = in[outputinputcomponentindices[c]];
                }
@@ -849,6 +849,10 @@ unsigned char *loadimagepixelsbgra (const char *filename, qboolean complain, qbo
                        Con_Printf(format == firstformat ? "\"%s\"" : (format[1].formatstring ? ", \"%s\"" : " or \"%s\".\n"), format->formatstring);
                }
        }
+
+       // texture loading can take a while, so make sure we're sending keepalives
+       CL_KeepaliveMessage(false);
+
        if (developer_memorydebug.integer)
                Mem_CheckSentinelsGlobal();
        return NULL;
@@ -873,7 +877,7 @@ int fixtransparentpixels(unsigned char *data, int w, int h)
        int const FIXTRANS_HAS_U = 8;
        int const FIXTRANS_HAS_D = 16;
        int const FIXTRANS_FIXED = 32;
-       unsigned char *fixMask = Mem_Alloc(tempmempool, w * h);
+       unsigned char *fixMask = (unsigned char *) Mem_Alloc(tempmempool, w * h);
        int fixPixels = 0;
        int changedPixels = 0;
        int x, y;
@@ -1017,6 +1021,7 @@ void Image_FixTransparentPixels_f(void)
                        Con_Printf("unchanged.\n");
                Mem_Free(data);
        }
+       FS_FreeSearch(search);
 }
 
 qboolean Image_WriteTGABGR_preflipped (const char *filename, int width, int height, const unsigned char *data, unsigned char *buffer)