diff options
author | John Hawthorn <jhawthor@uvic.ca> | 2008-06-16 16:25:58 -0700 |
---|---|---|
committer | John Hawthorn <jhawthor@uvic.ca> | 2008-06-16 16:25:58 -0700 |
commit | e97407561d66bf0aa4d02905e0b2693455b34a6b (patch) | |
tree | 4bd9c29edae469be00886aa924a26c027ee9dcd1 | |
parent | 0e03461ca2c584cacda2647b68d2eb8b0c34c216 (diff) | |
download | mirror-meh-e97407561d66bf0aa4d02905e0b2693455b34a6b.tar.gz mirror-meh-e97407561d66bf0aa4d02905e0b2693455b34a6b.tar.bz2 mirror-meh-e97407561d66bf0aa4d02905e0b2693455b34a6b.zip |
fixed ximage()
-rw-r--r-- | src/main.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -77,13 +77,13 @@ XImage *ximage(struct image *img, int width, int height) { bshift = getshift(vis->blue_mask); if (depth >= 24) { - size_t numNewBufBytes = (4 * (width * height)); + size_t numNewBufBytes = (4 * width * height); u_int32_t *newBuf = malloc(numNewBufBytes); for(y = 0; y < height; y++){ for(x = 0; x < width; x++){ unsigned int r, g, b; - i = ((y * img->height / height + x) * img->width / width) * 3; + i = (y * img->height / height * img->width + x * img->width / width) * 3; r = (img->buf[i++] << rshift) & vis->red_mask; g = (img->buf[i++] << gshift) & vis->green_mask; b = (img->buf[i++] << bshift) & vis->blue_mask; @@ -106,7 +106,7 @@ XImage *ximage(struct image *img, int width, int height) { for(y = 0; y < height; y++){ for(x = 0; x < width; x++){ unsigned int r, g, b; - i = ((y * img->height / height + x) * img->width / width) * 3; + i = (y * img->height / height * img->width + x * img->width / width) * 3; r = (img->buf[i++] << rshift) & vis->red_mask; g = (img->buf[i++] << gshift) & vis->green_mask; b = (img->buf[i++] << bshift) & vis->blue_mask; |