//
// png_write_png from 0x663214 to 0x6632f2 (222 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
int __fastcall png_write_png(int result, _DWORD *a2, __int16 a3)
{
bool v3; // zf
int v6; // r5
v3 = a2 == nullptr;
if ( a2 )
v3 = result == 0;
if ( !v3 )
{
if ( (a2[2] & 0x8000) != 0 )
{
v6 = result;
png_write_info(result, (int)a2);
if ( (a3 & 0x20) != 0 )
png_set_invert_mono(v6);
if ( (a3 & 0x40) != 0 && (a2[2] & 2) != 0 )
png_set_shift(v6, (int)(a2 + 37));
if ( (a3 & 4) != 0 )
png_set_packing(v6);
if ( (a3 & 0x100) != 0 )
png_set_swap_alpha(v6);
if ( (a3 & 0x1800) != 0 )
{
if ( (a3 & 0x1000) != 0 )
{
if ( (a3 & 0x800) != 0 )
png_app_error(v6, "PNG_TRANSFORM_STRIP_FILLER: BEFORE+AFTER not supported");
png_set_filler(v6, 0, 1);
}
else if ( (a3 & 0x800) != 0 )
{
png_set_filler(v6, 0, a3 & 0x1000);
}
}
if ( (a3 & 0x80) != 0 )
png_set_bgr(v6);
if ( (a3 & 0x200) != 0 )
png_set_swap(v6);
if ( (a3 & 8) != 0 )
png_set_packswap(v6);
if ( (a3 & 0x400) != 0 )
png_set_invert_alpha(v6);
png_write_image(v6, a2[66]);
return png_write_end(v6, a2);
}
else
{
return png_app_error(result, "no rows for png_write_image to write");
}
}
return result;
}