X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=libpicofe.git;a=blobdiff_plain;f=readpng.c;fp=readpng.c;h=ac24dd4f8424e2c00ed8e671b6aacaac38a37629;hp=83936ae9ba3d087a9f71d959f82b67e201c69e6c;hb=7167e5f3376f0d0692ae102ed2df1ef5d2cc199a;hpb=33787db41d955f8dcafe833097f2cc87d70186ec diff --git a/readpng.c b/readpng.c index 83936ae..ac24dd4 100644 --- a/readpng.c +++ b/readpng.c @@ -80,12 +80,14 @@ int readpng(void *dest, const char *fname, readpng_what what, int req_w, int req if (width > req_w) { x_ofs = (width - req_w) / 2; width = req_w; - } + } else + dst += (req_w - width) / 2; height = png_get_image_height(png_ptr, info_ptr); if (height > req_h) { y_ofs = (height - req_h) / 2; height = req_h; - } + } else + dst += (req_h - height) / 2 * req_w; for (h = 0; h < height; h++) {