Skip to content

Commit ca290d7

Browse files
committed
Expand PNG_COLOR_TYPE_GRAY_ALPHA to RGBA
Fixes #494 (cherry picked from commit ae0b7c4) (cherry picked from commit df9552d)
1 parent a0afc65 commit ca290d7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/IMG_png.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,11 @@ static void LIBPNG_LoadPNG_RW(SDL_RWops *src, struct loadpng_vars *vars)
305305
lib.png_set_packing(vars->png_ptr);
306306

307307
/* scale greyscale values to the range 0..255 */
308-
if (color_type == PNG_COLOR_TYPE_GRAY)
308+
if (color_type == PNG_COLOR_TYPE_GRAY) {
309309
lib.png_set_expand(vars->png_ptr);
310+
} else if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
311+
lib.png_set_gray_to_rgb(vars->png_ptr);
312+
}
310313

311314
/* For images with a single "transparent colour", set colour key;
312315
if more than one index has transparency, or if partially transparent

0 commit comments

Comments
 (0)