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 482970c5ab94aa39981b016794510d9a445ea93b (commit) from 915c8aa8fc5ebe66b6a9629f57f5d724700c10ac (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/482970c5ab94aa39981b016794510d9a445ea...
commit 482970c5ab94aa39981b016794510d9a445ea93b Author: Cyril Hrubis metan@ucw.cz Date: Thu Jan 3 01:44:18 2013 +0100
loaders: png: Load images with alpha channel too.
We have limited support for blits with alpha channel and spiv can now show some of the pngs with it.
diff --git a/libs/loaders/GP_PNG.c b/libs/loaders/GP_PNG.c index c963794..1c11d54 100644 --- a/libs/loaders/GP_PNG.c +++ b/libs/loaders/GP_PNG.c @@ -166,15 +166,26 @@ GP_Context *GP_ReadPNG(FILE *f, GP_ProgressCallback *callback) } break; case PNG_COLOR_TYPE_RGB: - + png_set_bgr(png); - + switch (depth) { case 8: pixel_type = GP_PIXEL_RGB888; break; } break; + case PNG_COLOR_TYPE_RGB | PNG_COLOR_MASK_ALPHA: + + png_set_bgr(png); + png_set_swap_alpha(png); + + switch (depth) { + case 8: + pixel_type = GP_PIXEL_RGBA8888; + break; + } + break; case PNG_COLOR_TYPE_PALETTE: /* Grayscale with BPP < 8 is usually saved as palette */ if (png_get_channels(png, png_info) == 1) { @@ -192,14 +203,16 @@ GP_Context *GP_ReadPNG(FILE *f, GP_ProgressCallback *callback) png_set_bgr(png);
png_read_update_info(png, png_info); - + png_get_IHDR(png, png_info, &w, &h, &depth, &color_type, NULL, NULL, NULL);
- if (color_type & PNG_COLOR_MASK_ALPHA) - pixel_type = GP_PIXEL_UNKNOWN; - else + if (color_type & PNG_COLOR_MASK_ALPHA) { + pixel_type = GP_PIXEL_RGBA8888; + png_set_swap_alpha(png); + } else { pixel_type = GP_PIXEL_RGB888; + } break; }
-----------------------------------------------------------------------
Summary of changes: libs/loaders/GP_PNG.c | 25 +++++++++++++++++++------ 1 files changed, 19 insertions(+), 6 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.