This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via c7c32efcf6deac514ea58f8adef8185afc0a3788 (commit) from 3966bfc09a6af79182519c6083f6beb085ef26e0 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/c7c32efcf6deac514ea58f8adef8185afc0a3...
commit c7c32efcf6deac514ea58f8adef8185afc0a3788 Author: Cyril Hrubis metan@ucw.cz Date: Fri May 10 11:36:09 2013 +0200
loaders: PNG: Fix Adam7 interlacing handling.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/libs/loaders/GP_PNG.c b/libs/loaders/GP_PNG.c index b1b725d..ce03c85 100644 --- a/libs/loaders/GP_PNG.c +++ b/libs/loaders/GP_PNG.c @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301 USA * * * - * Copyright (C) 2009-2012 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2013 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -106,7 +106,7 @@ GP_Context *GP_ReadPNG(FILE *f, GP_ProgressCallback *callback) int depth, color_type, interlace_type; GP_PixelType pixel_type = GP_PIXEL_UNKNOWN; GP_Context *res; - int err; + int err, passes = 1; double gamma;
png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); @@ -148,6 +148,9 @@ GP_Context *GP_ReadPNG(FILE *f, GP_ProgressCallback *callback) color_type & PNG_COLOR_MASK_ALPHA ? " with alpha channel" : "", (unsigned int)w, (unsigned int)h, depth, gamma);
+ if (interlace_type == PNG_INTERLACE_ADAM7) + passes = png_set_interlace_handling(png); + switch (color_type) { case PNG_COLOR_TYPE_GRAY: switch (depth) { @@ -233,19 +236,26 @@ GP_Context *GP_ReadPNG(FILE *f, GP_ProgressCallback *callback) png_set_packswap(png);
uint32_t y; - - /* start the actuall reading */ - for (y = 0; y < h; y++) { - png_bytep row = GP_PIXEL_ADDR(res, 0, y); - png_read_row(png, row, NULL); - - if (GP_ProgressCallbackReport(callback, y, h, w)) { - GP_DEBUG(1, "Operation aborted"); - err = ECANCELED; - goto err3; + int p; + + /* + * Do the actuall reading. + * + * The passes are needed for adam7 interlacing. + */ + for (p = 0; p < passes; p++) { + for (y = 0; y < h; y++) { + png_bytep row = GP_PIXEL_ADDR(res, 0, y); + png_read_row(png, row, NULL); + + if (GP_ProgressCallbackReport(callback, y + h * p, h * passes, w)) { + GP_DEBUG(1, "Operation aborted"); + err = ECANCELED; + goto err3; + } } } - + png_destroy_read_struct(&png, &png_info, NULL);
GP_ProgressCallbackDone(callback);
-----------------------------------------------------------------------
Summary of changes: libs/loaders/GP_PNG.c | 36 +++++++++++++++++++++++------------- 1 files changed, 23 insertions(+), 13 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.