//
// png_read_image from 0xbd5738 to 0xbd57fc (196 bytes)
//
// 3 xrefs:
// > cocos2d::CCImage::_initWithPngData @ 0xb0c1c8
// > png_read_png @ 0xbd5fb0
// > ??> @ 0x9c3a8
//
// 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
//
__int64 __fastcall png_read_image(__int64 result, __int64 a2)
{
__int64 v2; // x21
int v4; // w23
unsigned int v5; // w20
int v6; // w22
__int64 i; // x19
void *v8; // x1
v2 = result;
if ( result )
{
if ( (*(_DWORD *)(result + 360) & 0x40) != 0 )
{
if ( *(_BYTE *)(result + 684) && (*(_DWORD *)(result + 364) & 2) == 0 )
{
png_warning(result, "Interlace handling should be turned on when using png_read_image");
*(_DWORD *)(v2 + 568) = *(_DWORD *)(v2 + 564);
}
result = png_set_interlace_handling(v2);
v4 = result;
}
else
{
v4 = png_set_interlace_handling(result);
result = png_start_read_image(v2);
}
v5 = *(_DWORD *)(v2 + 564);
v6 = 0;
if ( v4 > 0 )
{
do
{
for ( i = 0; v5 > (unsigned int)i; result = png_read_row(v2, v8, nullptr) )
v8 = *(void **)(a2 + 8 * i++);
++v6;
}
while ( v6 != v4 );
}
}
return result;
}