Skip to content

Commit

Permalink
Support Greyscale PNGs created by Pngcrush.
Browse files Browse the repository at this point in the history
Pngcrush optimizer will sometimes create greyscale images for the cursor
resources.  These are not loaded correctly without being explicitly
converted.
  • Loading branch information
Deledrius committed Nov 12, 2024
1 parent 0352749 commit a690e68
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Sources/Plasma/PubUtilLib/plGImage/plPNG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,13 @@ plMipmap* plPNG::IRead(hsStream* inStream)
channels = 3;
break;
case PNG_COLOR_TYPE_GRAY:

if (bitdepth < 8) {
if (bitdepth < 8)
png_set_expand_gray_1_2_4_to_8(png_ptr);
}

bitdepth = 8;
[[fallthrough]];
case PNG_COLOR_TYPE_GRAY_ALPHA:
png_set_gray_to_rgb(png_ptr);
channels = 3;
break;
}

Expand Down

0 comments on commit a690e68

Please sign in to comment.