aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Hawthorn <jhawthor@uvic.ca>2008-06-16 16:25:58 -0700
committerJohn Hawthorn <jhawthor@uvic.ca>2008-06-16 16:25:58 -0700
commite97407561d66bf0aa4d02905e0b2693455b34a6b (patch)
tree4bd9c29edae469be00886aa924a26c027ee9dcd1
parent0e03461ca2c584cacda2647b68d2eb8b0c34c216 (diff)
downloadmirror-meh-e97407561d66bf0aa4d02905e0b2693455b34a6b.tar.gz
mirror-meh-e97407561d66bf0aa4d02905e0b2693455b34a6b.tar.bz2
mirror-meh-e97407561d66bf0aa4d02905e0b2693455b34a6b.zip
fixed ximage()
-rw-r--r--src/main.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index cad5085..e67792f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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;