BgpGxConvertRectangleEx
INT64 __fastcall BgpGxConvertRectangleEx(INT64 a1, UINT64 a2, INT64 *a3, CHAR a4){
INT64 *v4;
unsigned int v5;
INT64 v6;
char v7;
char v8;
INT64 result;
INT64 v10;
unsigned int v11;
UINT8 *v12;
UINT8 *v13;
unsigned int v14;
unsigned int v15;
__int64 v16;
unsigned int v17;
unsigned int v18;
__int64 v19;
signed __int64 v20;
unsigned int v21;
int *v22;
__int64 v23;
int v24;
int v25;
char v26;
unsigned int v27;
UINT8 *v28;
int v29;
int v30;
int v31[4];
__int64 v32[9];
char v35;
v4 = a3;
v31[2] = 0;
v5 = a2;
v6 = a1;
v7 = 0;
if( (a4 & 1) != 0 )
{
v8 = 1;
v35 = 1;
if( (unsigned int)a2 > *(_DWORD *)(a1 + 8) )
return 3221225485i64;
v10 = *a3;
*(_DWORD *)v10 = *(_DWORD *)a1;
*(_DWORD *)(v10 + 4) = *(_DWORD *)(a1 + 4);
*(_DWORD *)(v10 + 8) = a2;
*(_DWORD *)(v10 + 16) = 0;
*(_DWORD *)(v10 + 12) = *(_DWORD *)(a1 + 12);
*(_QWORD *)(v10 + 24) = *(_QWORD *)(a1 + 24);
}
else
{
v31[1] = *(_DWORD *)a1;
v8 = 0;
v35 = 0;
v31[0] = *(_DWORD *)(a1 + 4);
v32[0] = 0i64;
result = BgpGxRectangleCreate(v31, a2, v32);
if( (int)result < 0 )
return result;
v10 = v32[0];
}
v11 = *(_DWORD *)(v6 + 8);
v12 = *(UINT8 **)(v10 + 24);
v13 = *(UINT8 **)(v6 + 24);
v14 = v11 >> 3;
LODWORD(v32[0]) = v11 >> 3;
if( v11 != v5 )
{
if( v5 == 4 )
{
v17 = 0;
if( *(_DWORD *)v10 )
{
do
{
v18 = 0;
if( *(_DWORD *)(v10 + 4) )
{
v19 = v14;
do
{
v31[0] = -1;
v20 = (char *)FourBitPalette - (char *)&v30;
v29 = 0;
v30 = *(_DWORD *)v13;
do
{
v21 = 0;
v22 = &v30;
v23 = 3i64;
do
{
v24 = *((unsigned __int8 *)v22 + v20);
v25 = *(unsigned __int8 *)v22;
v22 = (int *)((char *)v22 + 1);
v21 += abs32(v25 - v24) + 2 * abs32(v25 - v24);
--v23;
}
while( v23 );
v26 = v29;
if( v21 >= v31[0] )
v26 = v7;
v27 = v29 + 1;
v20 += 4i64;
++v29;
v7 = v26;
if( v21 >= v31[0] )
v21 = v31[0];
v31[0] = v21;
}
while( v27 < 0x10 );
if( (v18 & 1) != 0 )
*v12++ |= v26;
else
*v12 = 16 * v26;
v13 += v19;
++v18;
}
while( v18 < *(_DWORD *)(v10 + 4) );
v14 = v32[0];
}
++v17;
v28 = v12 + 1;
if( (v18 & 1) == 0 )
v28 = v12;
v12 = v28;
}
while( v17 < *(_DWORD *)v10 );
v6 = a1;
v8 = v35;
v4 = a3;
}
}
else
{
v15 = *(_DWORD *)v10 * *(_DWORD *)(v10 + 4);
if( v15 )
{
v16 = v15;
do
{
v12[2] = v13[2];
v12[1] = v13[1];
*v12 = *v13;
if( v5 == 32 )
v12[3] = 0;
v13 += v14;
v12 += v5 >> 3;
--v16;
}
while( v16 );
}
}
if( v8 )
*(_DWORD *)(v6 + 16) |= 0x10u;
goto LABEL_7;
}
if( !v8 )
{
memmove(v12, v13, *(unsigned int *)(v6 + 12));
LABEL_7:
*v4 = v10;
}
return 0i64;
}Referenced by:
AnFwDisplayFade
BgpGxConvertRectangle
BgpGxDrawRectangle
BgpTxtDisplayCharacter
GxpWriteFrameBufferPixels