png: libpng is straight alpha, but cairo is premult
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

ref #23
This commit is contained in:
Vaxry 2025-07-06 15:22:25 +02:00
parent a71c0529d1
commit b841473a0b
Signed by: vaxry
GPG key ID: 665806380871D640

View file

@ -111,6 +111,10 @@ static std::expected<cairo_surface_t*, std::string> loadPNG(png_structp png, png
uint8_t g = rawData[i + 1];
uint8_t b = rawData[i + 2];
uint8_t a = rawData[i + 3];
r *= ((float)a) / 255.F;
g *= ((float)a) / 255.F;
b *= ((float)a) / 255.F;
*(uint32_t*)&rawData[i] = (a << 24) | (r << 16) | (g << 8) | b;
}