X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fimage.c;h=f06a126ec6171fbcdc74014af811cc39c79ca202;hb=76510834f382bc82548e72c8e7f6f7672c9484dc;hp=95e098e22c578ccf42b14cc161c2fa89fbd3b983;hpb=c2e3fd53db25f745d11fbe9b19bef78b3a3461a7;p=rocksndiamonds.git diff --git a/src/libgame/image.c b/src/libgame/image.c index 95e098e2..f06a126e 100644 --- a/src/libgame/image.c +++ b/src/libgame/image.c @@ -586,9 +586,13 @@ void ZoomPixmap(Display *display, GC gc, Pixmap src_pixmap, Pixmap dst_pixmap, int zoom_factor = src_width / dst_width; /* currently very limited! */ int row_skip, col_skip; + /* adjust source image size to integer multiple of destination image size */ + src_width = dst_width * zoom_factor; + src_height = dst_height * zoom_factor; + /* copy source pixmap to temporary image */ - src_ximage = XGetImage(display, src_pixmap, 0, 0, - src_width, src_height, AllPlanes, ZPixmap); + src_ximage = XGetImage(display, src_pixmap, 0, 0, src_width, src_height, + AllPlanes, ZPixmap); bits_per_pixel = src_ximage->bits_per_pixel; bytes_per_pixel = (bits_per_pixel + 7) / 8; @@ -609,12 +613,12 @@ void ZoomPixmap(Display *display, GC gc, Pixmap src_pixmap, Pixmap dst_pixmap, /* scale image down by scaling factor 'zoom_factor' */ for (y=0; y < src_height; y += zoom_factor, src_ptr += row_skip) for (x=0; x < src_width; x += zoom_factor, src_ptr += col_skip) - for (i=0; i