mirror of
https://github.com/hyprwm/hyprgraphics.git
synced 2025-12-25 20:30:04 +01:00
png: fix gray pix formats (#35)
Some checks failed
Build & Test (Arch) / Arch: Build and Test (gcc) (push) Has been cancelled
Build & Test (Arch) / Arch: Build and Test (clang) (push) Has been cancelled
Build & Test / nix (hyprgraphics) (push) Has been cancelled
Build & Test / nix (hyprgraphics-with-tests) (push) Has been cancelled
Some checks failed
Build & Test (Arch) / Arch: Build and Test (gcc) (push) Has been cancelled
Build & Test (Arch) / Arch: Build and Test (clang) (push) Has been cancelled
Build & Test / nix (hyprgraphics) (push) Has been cancelled
Build & Test / nix (hyprgraphics-with-tests) (push) Has been cancelled
This commit is contained in:
parent
621e2e00f1
commit
aa9d14963b
1 changed files with 2 additions and 2 deletions
|
|
@ -86,13 +86,13 @@ static std::expected<cairo_surface_t*, std::string> loadPNG(png_structp png, png
|
|||
png_set_palette_to_rgb(png);
|
||||
if (COLOR_TYPE == PNG_COLOR_TYPE_GRAY && BPP < 8)
|
||||
png_set_expand_gray_1_2_4_to_8(png);
|
||||
if (COLOR_TYPE == PNG_COLOR_TYPE_GRAY || COLOR_TYPE == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||
png_set_gray_to_rgb(png);
|
||||
if (png_get_valid(png, info, PNG_INFO_tRNS))
|
||||
png_set_tRNS_to_alpha(png);
|
||||
|
||||
if (COLOR_TYPE == PNG_COLOR_TYPE_RGB || COLOR_TYPE == PNG_COLOR_TYPE_GRAY || COLOR_TYPE == PNG_COLOR_TYPE_PALETTE)
|
||||
png_set_filler(png, 0xFF, PNG_FILLER_AFTER);
|
||||
else if (COLOR_TYPE == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||
png_set_gray_to_rgb(png);
|
||||
|
||||
png_read_update_info(png, info);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue