mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-10 23:02:16 +00:00
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:
parent
de79e1433d
commit
86222ca684
1 changed files with 4 additions and 14 deletions
|
@ -1042,15 +1042,9 @@ GL_ResampleTexture (unsigned int *in, int inwidth, int inheight,
|
||||||
for (i = 0; i < outheight; i++, out += outwidth) {
|
for (i = 0; i < outheight; i++, out += outwidth) {
|
||||||
inrow = in + inwidth * (i * inheight / outheight);
|
inrow = in + inwidth * (i * inheight / outheight);
|
||||||
frac = fracstep >> 1;
|
frac = fracstep >> 1;
|
||||||
for (j = 0; j < outwidth; j += 4) {
|
for (j = 0; j < outwidth; j ++) {
|
||||||
out[j] = inrow[frac >> 16];
|
out[j] = inrow[frac >> 16];
|
||||||
frac += fracstep;
|
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 char *inrow;
|
||||||
unsigned int frac, fracstep;
|
unsigned int frac, fracstep;
|
||||||
|
|
||||||
|
if (!outwidth || !outheight)
|
||||||
|
return;
|
||||||
fracstep = inwidth * 0x10000 / outwidth;
|
fracstep = inwidth * 0x10000 / outwidth;
|
||||||
for (i = 0; i < outheight; i++, out += outwidth) {
|
for (i = 0; i < outheight; i++, out += outwidth) {
|
||||||
inrow = in + inwidth * (i * inheight / outheight);
|
inrow = in + inwidth * (i * inheight / outheight);
|
||||||
frac = fracstep >> 1;
|
frac = fracstep >> 1;
|
||||||
for (j = 0; j < outwidth; j += 4) {
|
for (j = 0; j < outwidth; j ++) {
|
||||||
out[j] = inrow[frac >> 16];
|
out[j] = inrow[frac >> 16];
|
||||||
frac += fracstep;
|
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue