Fixed up- scaling (thanks to Tom Robert Bryntesen)

This commit is contained in:
Erik Duijs 2004-05-03 09:55:45 +00:00
parent 08fc228d2c
commit d3f675581f
1 changed files with 12 additions and 3 deletions

View File

@ -247,9 +247,18 @@ public class MipMap extends Util {
// store weighted pixel
dst = (iy * widthOut + ix) * components;
for (k = 0; k < components; k++) {
tempout[dst++] = c[k] / readPix;
}
if (readPix == 0) {
// Image is sized up, caused by non power of two texture as input
src = (y0 * widthIn + x0) * components;
for (int ic = 0; ic < components; ic++) {
tempout[dst++] = tempin[src + ic];
}
} else {
// sized down
for (k = 0; k < components; k++) {
tempout[dst++] = c[k] / readPix;
}
}
}
}