From 19e4e109ee0a2174e494493b221461fdc1b8bdbf Mon Sep 17 00:00:00 2001 From: Till Adam Date: Wed, 3 Jan 2001 21:42:10 +0000 Subject: [PATCH] ok, fix for the ascii ppm formats. They seemed to have the same problem. This should be it now, provided the save in ppm format works as expected which it seems to do from geist at least. SVN revision: 4088 --- loaders/loader_pnm.c | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/loaders/loader_pnm.c b/loaders/loader_pnm.c index 360fe04..83dfb5d 100644 --- a/loaders/loader_pnm.c +++ b/loaders/loader_pnm.c @@ -193,10 +193,15 @@ load(ImlibImage * im, ImlibProgressFunction progress, per = (char) ((100 * y) / im->h); if (((per - pper) >= progress_granularity) || (y == (im->h - 1))) - { + { l = y - pl; - if (!progress(im, per, 0, (y - l), im->w, l)) - { + + /* fix off by one in case of the last line */ + if (y == (im->h -1)) + l++; + + if (!progress(im, per, 0, pl, im->w, l)) + { fclose(f); return 2; } @@ -276,11 +281,17 @@ load(ImlibImage * im, ImlibProgressFunction progress, per = (char) ((100 * y) / im->h); if (((per - pper) >= progress_granularity) || (y == (im->h - 1))) - { - l = y - pl; - if (!progress(im, per, 0, (y - l), im->w, l)) - { - if (idata) + { + + l = y - pl; + + /* fix off by one in case of the last line */ + if (y == (im->h -1)) + l++; + + if (!progress(im, per, 0, pl, im->w, l)) + { + if (idata) free(idata); fclose(f); return 2; @@ -363,10 +374,15 @@ load(ImlibImage * im, ImlibProgressFunction progress, per = (char) ((100 * y) / im->h); if (((per - pper) >= progress_granularity) || (y == (im->h - 1))) - { - l = y - pl; - if (!progress(im, per, 0, (y - l), im->w, l)) - { + { + l = y - pl; + + /* fix off by one in case of the last line */ + if (y == (im->h -1)) + l++; + + if (!progress(im, per, 0, pl, im->w, l)) + { if (idata) free(idata); fclose(f);