tiny speedup to texture uploads

This commit is contained in:
Bill Currie 2001-12-21 20:12:51 +00:00
parent 858bb55bcc
commit 168d3aa308

View file

@ -504,7 +504,7 @@ void
GL_Upload8 (byte * data, int width, int height, qboolean mipmap, qboolean alpha) GL_Upload8 (byte * data, int width, int height, qboolean mipmap, qboolean alpha)
{ {
int i, s, p; int i, s, p;
unsigned int *trans = NULL; unsigned int *trans;
s = width * height; s = width * height;
trans = malloc (s * sizeof (unsigned int)); trans = malloc (s * sizeof (unsigned int));
@ -522,13 +522,10 @@ GL_Upload8 (byte * data, int width, int height, qboolean mipmap, qboolean alpha)
trans[i] = d_8to24table[p]; trans[i] = d_8to24table[p];
} }
} else { } else {
if (s & 3) unsigned int *out = trans;
Sys_Error ("GL_Upload8: width*height divisible by 3"); byte *in = data;
for (i = 0; i < s; i += 4) { for (i = 0; i < s; i++) {
trans[i] = d_8to24table[data[i]]; *out++ = d_8to24table[*in++];
trans[i + 1] = d_8to24table[data[i + 1]];
trans[i + 2] = d_8to24table[data[i + 2]];
trans[i + 3] = d_8to24table[data[i + 3]];
} }
} }