From 86222ca68423f9caf8aff5f921cf6813e6e42c3a Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 24 Dec 2000 04:59:15 +0000 Subject: [PATCH] don't unroll the resaple loops manually. causes segs for < 4 pixel output textures (now 2x2 and 1x1 will work. 0x0 is just ignored) --- source/gl_draw.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/source/gl_draw.c b/source/gl_draw.c index 9aec3f6..4685fb5 100644 --- a/source/gl_draw.c +++ b/source/gl_draw.c @@ -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; } } }