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 965a9237db419f83183eb4a59fc9bc741782093e (commit) from e403e7ee1b9adba8f821a623d862a03ac7afc941 (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/965a9237db419f83183eb4a59fc9bc7417820...
commit 965a9237db419f83183eb4a59fc9bc741782093e Author: Cyril Hrubis metan@ucw.cz Date: Sun May 27 15:26:29 2012 +0200
loaders: Use png_set_packswap() (to reduce size of code).
diff --git a/libs/loaders/GP_PNG.c b/libs/loaders/GP_PNG.c index 2afb072..742cf46 100644 --- a/libs/loaders/GP_PNG.c +++ b/libs/loaders/GP_PNG.c @@ -200,7 +200,7 @@ GP_Context *GP_ReadPNG(FILE *f, GP_ProgressCallback *callback) }
if (color_type == PNG_COLOR_TYPE_GRAY) - res->bit_endian = 1; + png_set_packswap(png);
uint32_t y; @@ -305,48 +305,23 @@ static int prepare_png_header(const GP_Context *src, png_structp png, return 0; }
-static int write_png_data_g_swap(const GP_Context *src, png_structp png, - GP_ProgressCallback *callback) +static int write_png_data(const GP_Context *src, png_structp png, + GP_ProgressCallback *callback, int bit_endian_flag) { - unsigned int y; - uint8_t row[src->bytes_per_row]; - - for (y = 0; y < src->h; y++) { - memcpy(row, GP_PIXEL_ADDR(src, 0, y), src->bytes_per_row); - + /* Look if we need to swap data when writing */ + if (bit_endian_flag) { switch (src->pixel_type) { case GP_PIXEL_G1: - GP_BitSwapRow_B1(row, src->bytes_per_row); - break; case GP_PIXEL_G2: - GP_BitSwapRow_B4(row, src->bytes_per_row); - break; case GP_PIXEL_G4: - GP_BitSwapRow_B4(row, src->bytes_per_row); + png_set_packswap(png); break; default: return ENOSYS; break; } - - png_write_row(png, row); - - if (GP_ProgressCallbackReport(callback, y, src->h, src->w)) { - GP_DEBUG(1, "Operation aborted"); - return ECANCELED; - } }
- return 0; -} - -static int write_png_data(const GP_Context *src, png_structp png, - GP_ProgressCallback *callback, int bit_endian_flag) -{ - /* Look if we need to swap data when writing */ - if (bit_endian_flag) - return write_png_data_g_swap(src, png, callback); - unsigned int y;
for (y = 0; y < src->h; y++) {
-----------------------------------------------------------------------
Summary of changes: libs/loaders/GP_PNG.c | 37 ++++++------------------------------- 1 files changed, 6 insertions(+), 31 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.