Skip to content

Commit

Permalink
Fixed handling of grayscale images with alpha
Browse files Browse the repository at this point in the history
Fixes #460

(cherry picked from commit 39c8ebb)
  • Loading branch information
slouken committed Aug 5, 2024
1 parent 0a08a01 commit 0000fb0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/IMG_png.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,14 +336,14 @@ static void LIBPNG_LoadPNG_RW(SDL_RWops *src, struct loadpng_vars *vars)
/* more than one transparent index, or translucency */
lib.png_set_expand(vars->png_ptr);
}
} else if (color_type == PNG_COLOR_TYPE_GRAY) {
/* This will be turned into PNG_COLOR_TYPE_GRAY_ALPHA, so expand to RGBA */
lib.png_set_gray_to_rgb(vars->png_ptr);
} else {
ckey = 0; /* actual value will be set later */
}
}

if ( color_type == PNG_COLOR_TYPE_GRAY_ALPHA )
lib.png_set_gray_to_rgb(vars->png_ptr);

lib.png_read_update_info(vars->png_ptr, vars->info_ptr);

lib.png_get_IHDR(vars->png_ptr, vars->info_ptr, &width, &height, &bit_depth,
Expand Down

0 comments on commit 0000fb0

Please sign in to comment.