Skip to content
Snippets Groups Projects
Commit db873512 authored by Lactozilla's avatar Lactozilla :speech_balloon:
Browse files

Don't force 16bpp if the bit depth was already higher!

parent 42895b2c
No related branches found
No related tags found
1 merge request!675PNG conversion refactoring
......@@ -925,16 +925,21 @@ void *Picture_PNGConvert(
png_bytep *row_pointers = PNG_Read(png, w, h, topoffset, leftoffset, insize);
png_uint_32 width = *w, height = *h;
// Find the output format's bits per pixel amount
outbpp = Picture_FormatBPP(outformat);
// Hack for patches because you'll want to preserve transparency.
if (Picture_IsPatchFormat(outformat))
outbpp = 16;
else
{
outbpp = Picture_FormatBPP(outformat);
if (!outbpp)
I_Error("Picture_PNGConvert: unknown output bits per pixel?!");
// Force a higher bit depth
if (outbpp == 8)
outbpp = 16;
}
// Shouldn't happen.
if (!outbpp)
I_Error("Picture_PNGConvert: unknown output bits per pixel?!");
// Figure out the size
flatsize = (width * height) * (outbpp / 8);
if (outsize)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment