Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 808aeae
Author: Hayaki Saito <[email protected]>
Date:   Tue Feb 17 00:20:18 2015 +0900

    Use png_set_packing to expand 1/2/4bpp paletted PNG (for Issue #29)

commit cb53ae1
Author: Hayaki Saito <[email protected]>
Date:   Tue Feb 17 00:13:23 2015 +0900

    Revert "libpng loader: expand 1/2/4bpp palette to 8bpp (for issue #29)"

    This reverts commit b6748d1.

commit b6748d1
Author: saitoha <[email protected]>
Date:   Mon Feb 16 00:41:06 2015 +0900

    libpng loader: expand 1/2/4bpp palette to 8bpp (for issue #29)
  • Loading branch information
saitoha committed Feb 17, 2015
1 parent 80ec152 commit e6f09fd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion converters/loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,10 @@ load_png(unsigned char *buffer, int size,
switch (png_get_color_type(png_ptr, info_ptr)) {
case PNG_COLOR_TYPE_PALETTE:
palette_bitdepth = png_get_PLTE(png_ptr, info_ptr, &png_palette, pncolors);
if (ppalette && png_palette && bitdepth == 8 && palette_bitdepth == 8 && *pncolors <= reqcolors) {
if (ppalette && png_palette && palette_bitdepth == 8 && *pncolors <= reqcolors) {
if (bitdepth != 8) {
png_set_packing(png_ptr);
}
*ppalette = malloc(*pncolors * 3);
if (*ppalette == NULL) {
goto cleanup;
Expand All @@ -356,6 +359,7 @@ load_png(unsigned char *buffer, int size,
*pcomp = 1;
*pixelformat = PIXELFORMAT_PAL8;
} else {
png_set_packing(png_ptr);
png_set_palette_to_rgb(png_ptr);
*pcomp = 3;
*pixelformat = PIXELFORMAT_RGB888;
Expand Down

0 comments on commit e6f09fd

Please sign in to comment.