don't unroll the resaple loops manually. causes segs for < 4 pixel output

textures (now 2x2 and 1x1 will work. 0x0 is just ignored)
This commit is contained in:
Bill Currie 2000-12-24 04:59:15 +00:00
parent de79e1433d
commit 86222ca684
1 changed files with 4 additions and 14 deletions

View File

@ -1042,15 +1042,9 @@ GL_ResampleTexture (unsigned int *in, int inwidth, int inheight,
for (i = 0; i < outheight; i++, out += outwidth) {
inrow = in + inwidth * (i * inheight / outheight);
frac = fracstep >> 1;
for (j = 0; j < outwidth; j += 4) {
for (j = 0; j < outwidth; j ++) {
out[j] = inrow[frac >> 16];
frac += fracstep;
out[j + 1] = inrow[frac >> 16];
frac += fracstep;
out[j + 2] = inrow[frac >> 16];
frac += fracstep;
out[j + 3] = inrow[frac >> 16];
frac += fracstep;
}
}
}
@ -1069,19 +1063,15 @@ GL_Resample8BitTexture (unsigned char *in, int inwidth, int inheight,
unsigned char *inrow;
unsigned int frac, fracstep;
if (!outwidth || !outheight)
return;
fracstep = inwidth * 0x10000 / outwidth;
for (i = 0; i < outheight; i++, out += outwidth) {
inrow = in + inwidth * (i * inheight / outheight);
frac = fracstep >> 1;
for (j = 0; j < outwidth; j += 4) {
for (j = 0; j < outwidth; j ++) {
out[j] = inrow[frac >> 16];
frac += fracstep;
out[j + 1] = inrow[frac >> 16];
frac += fracstep;
out[j + 2] = inrow[frac >> 16];
frac += fracstep;
out[j + 3] = inrow[frac >> 16];
frac += fracstep;
}
}
}