Fix loading paletted PNG without alpha channel
This commit is contained in:
parent
721c88fbee
commit
340a04d17c
1 changed files with 2 additions and 2 deletions
|
|
@ -61,13 +61,13 @@ namespace psemek::gfx
|
||||||
if (monochrome && color_type != PNG_COLOR_TYPE_GRAY)
|
if (monochrome && color_type != PNG_COLOR_TYPE_GRAY)
|
||||||
throw util::exception("Invalid color type for monochrome PNG");
|
throw util::exception("Invalid color type for monochrome PNG");
|
||||||
|
|
||||||
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
if (color_type & PNG_COLOR_MASK_PALETTE)
|
||||||
png_set_palette_to_rgb(png);
|
png_set_palette_to_rgb(png);
|
||||||
|
|
||||||
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
|
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
|
||||||
png_set_expand_gray_1_2_4_to_8(png);
|
png_set_expand_gray_1_2_4_to_8(png);
|
||||||
|
|
||||||
if (color_type == PNG_COLOR_TYPE_RGB)
|
if (!(color_type & PNG_COLOR_MASK_ALPHA))
|
||||||
png_set_add_alpha(png, 0xff, PNG_FILLER_AFTER);
|
png_set_add_alpha(png, 0xff, PNG_FILLER_AFTER);
|
||||||
|
|
||||||
png_read_update_info(png, info);
|
png_read_update_info(png, info);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue