1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 04:20:27 +01:00

Fixed a bug in scaling code.

This commit is contained in:
dan
2000-01-15 22:11:18 +00:00
parent 049a69a9bf
commit b7296cff16

View File

@@ -79,14 +79,11 @@ RScaleImage(RImage *image, unsigned new_width, unsigned new_height)
d = img->data;
if (image->format == RRGBAFormat) {
int ot;
ot = -1;
for (y=0; y<new_height; y++) {
t = image->width*(py>>16);
s = image->data+t;
s = image->data+(t<<2); /* image->data+t*4 */
ot = t;
ox = 0;
px = 0;
for (x=0; x<new_width; x++) {
@@ -105,14 +102,11 @@ RScaleImage(RImage *image, unsigned new_width, unsigned new_height)
py += dy;
}
} else {
int ot;
ot = -1;
for (y=0; y<new_height; y++) {
t = image->width*(py>>16);
s = image->data+t;
s = image->data+(t<<1)+t; /* image->data+t*3 */
ot = t;
ox = 0;
px = 0;
for (x=0; x<new_width; x++) {
@@ -122,7 +116,7 @@ RScaleImage(RImage *image, unsigned new_width, unsigned new_height)
*(d++) = *(s+1);
*(d++) = *(s+2);
t = (px-ox)>>16;
t = (px - ox)>>16;
ox += t<<16;
s += (t<<1)+t; /* t*3 */