RaspScanConvert
__int64 __fastcall RaspScanConvert(
__int64 a1,
__int64 a2,
__int64 a3,
int a4,
int a5,
__int64 a6,
__int64 a7,
_BG_RASTERIZER_WORKSPACE *Workspace){
bool v10;
_BG_RASTERIZER_WORKSPACE *v11;
int v12;
__int64 v13;
NTSTATUS v14;
NTSTATUS v15;
INT64 v16;
NTSTATUS v17;
unsigned int v18;
int v19;
int v20;
__int64 v21;
__int64 v22;
int v23;
int v24;
int v25;
int v26;
int v27;
int v28;
signed int v29;
int v30;
NTSTATUS v31;
_GRAPHICS_RECTANGLE *v32;
__int64 *Memory;
unsigned int v34;
__int64 v35;
int v36;
size_t v37;
unsigned int v38;
_GLYPH_SEGMENT *v39;
signed int v40;
__int64 v41;
_BYTE *v42;
int i;
_BYTE *v44;
char v45;
VOID *v46;
__int64 v48;
int v49;
int v50;
int v51;
int v52;
__int64 v53;
signed int v54;
signed int v55;
int v56;
int v57;
int v58;
INT64 XIntersection2;
int v60;
int v61;
_GLYPH_SEGMENT *SegmentList;
_GRAPHICS_RECTANGLE *GraphicsRectangle;
_RECTANGLE Rectangle;
INT64 XIntersection;
UINT64 SegmentCount;
int v67;
v67 = a4;
LODWORD(SegmentCount) = 0;
LODWORD(XIntersection) = 0;
LODWORD(XIntersection2) = 0;
GraphicsRectangle = 0i64;
SegmentList = 0i64;
v10 = (a5 & 1) != 0;
v11 = Workspace;
v12 = RaspCreateSegmentList(a1, a2, *(unsigned __int16 *)(a1 + 24), &SegmentList, (__int64)&SegmentCount, Workspace);
v13 = (unsigned int)SegmentCount;
v14 = v12;
if( v12 >= 0 )
{
v15 = BgpFmRoundUp(*(unsigned int *)(a1 + 14));
v16 = *(unsigned int *)(a1 + 6);
v67 = v15;
v17 = BgpFmRoundUp(v16);
v20 = v19 - v17 + 1;
if( v19 == v17 )
{
v56 = *(_DWORD *)(17i64 * (v18 + 1) + a2 + 4);
v57 = v56 >> 6;
if( v56 < 0 )
v57 |= 0xFC000000;
v20 = v57 + 1;
if( (v56 & 0x20) == 0 )
v20 = v57;
v67 = v20;
}
v21 = 17i64 * (v18 + 1);
v22 = 17i64 * v18;
v23 = *(_DWORD *)(v22 + a2);
v24 = *(_DWORD *)(v22 + a2 + 8);
v25 = *(_DWORD *)(v21 + a2) + *(_DWORD *)(v21 + a2 + 8) - v23 - v24;
v26 = v25 >> 6;
if( v25 < 0 )
v26 |= 0xFC000000;
v27 = v26 + 1;
v28 = 4 * v20;
if( (v25 & 0x20) == 0 )
v27 = v26;
v61 = 4 * v20;
v29 = 4 * v27;
v30 = v23 + v24;
v60 = v29;
Rectangle.Height = 4 * v20;
Rectangle.Width = v29;
Rectangle.Stride = v29;
if( v10 )
{
v32 = &::GraphicsRectangle;
GraphicsRectangle = &::GraphicsRectangle;
v14 = BgpGxInitializeRectangle(&Rectangle, 1ui64, &::GraphicsRectangle, 0xC44ui64);
if( v14 < 0 )
goto LABEL_32;
}
else
{
v31 = RaspRectangleCreate(&Rectangle, 1ui64, &GraphicsRectangle, v11);
v32 = GraphicsRectangle;
v14 = v31;
}
if( v14 >= 0 )
{
memset(*((VOID **)v32 + 3), 0i64, v32[3]);
if( !SegmentList )
{
v58 = v67;
*(_QWORD *)a6 = v32;
*(_DWORD *)a7 = v58;
return 0i64;
}
if( v10 )
{
if( v29 <= 104 )
{
Memory = qword_140D71E60;
goto LABEL_13;
}
}
else
{
Memory = (__int64 *)RaspAllocateMemory(4i64 * v29, v11);
if( Memory )
{
LABEL_13:
v34 = 0;
v35 = v29;
v36 = 0;
a5 = 0;
if( v28 > 0 )
{
v37 = 4 * v29;
HIDWORD(XIntersection2) = v67 << 6;
while( 1 )
{
memset(Memory, 0i64, v37);
v38 = HIDWORD(XIntersection2) + -16 * (v36 & 3) - ((unsigned int)v36 >> 2 << 6);
if( (_DWORD)v13 )
break;
LABEL_20:
v41 = 0i64;
v42 = (_BYTE *)(*((_QWORD *)GraphicsRectangle + 3) + ((unsigned __int64)v34 >> 3));
for( i = 128 >> (v34 & 7); v41 < v35; v42 = v44 )
{
if( *((_DWORD *)Memory + v41) )
*v42 |= i;
LOBYTE(i) = (unsigned __int8)i >> 1;
v44 = v42 + 1;
v45 = i;
if( !(_BYTE)i )
LOBYTE(i) = 0x80;
++v41;
if( v45 )
v44 = v42;
}
v34 += v29;
v37 = 4 * v35;
++v36;
a5 = v34;
if( v36 >= v61 )
goto LABEL_29;
}
v39 = SegmentList + 6;
while( 1 )
{
RaspTestIntersection(v39 - 6, v38, &XIntersection, &XIntersection2);
v40 = XIntersection;
if( (_DWORD)XIntersection != 0x7FFFFFFF )
break;
LABEL_18:
v39 = (_GLYPH_SEGMENT *)((char *)v39 + 25);
if( !--v13 )
{
v34 = a5;
v13 = (unsigned int)SegmentCount;
v29 = v60;
goto LABEL_20;
}
}
v48 = *((_QWORD *)v39 - 1);
v49 = *(_DWORD *)(v48 + 12);
v50 = v49
+ *(_DWORD *)(v48 + 4)
- *(_DWORD *)(*((_QWORD *)v39 - 3) + 12i64)
- *(_DWORD *)(*((_QWORD *)v39 - 3) + 4i64);
if( !v50 )
{
if( *(_BYTE *)v39 == 1 )
goto LABEL_59;
v50 = v49
+ *(_DWORD *)(v48 + 4)
- *(_DWORD *)(*((_QWORD *)v39 - 2) + 12i64)
- *(_DWORD *)(*((_QWORD *)v39 - 2) + 4i64);
}
if( v50 > 0 )
{
v51 = 1;
LABEL_38:
v52 = 0;
v53 = 0i64;
if( v35 <= 0 )
goto LABEL_18;
v54 = XIntersection2;
while( 1 )
{
v55 = v30 + ((16 * v52) & 0xFFFFFFC0) + 16 * (v52 & 3);
if( *(_BYTE *)v39 == 1 )
break;
if( v54 != 0x7FFFFFFF )
{
if( v55 < v40 || v55 > v54 )
goto LABEL_44;
LABEL_43:
*((_DWORD *)Memory + v53) += v51;
goto LABEL_44;
}
if( v55 <= v40 )
goto LABEL_43;
LABEL_44:
++v52;
if( ++v53 >= v35 )
goto LABEL_18;
}
if( v55 > v40 )
goto LABEL_44;
goto LABEL_43;
}
if( v50 < 0 )
{
v51 = -1;
goto LABEL_38;
}
LABEL_59:
v51 = 0;
goto LABEL_38;
}
LABEL_29:
v14 = 0;
*(_QWORD *)a6 = GraphicsRectangle;
*(_DWORD *)a7 = v67;
v11 = Workspace;
if( Memory == qword_140D71E60 )
goto LABEL_32;
v46 = Memory;
LABEL_31:
RaspFreeMemory(v46, v11);
goto LABEL_32;
}
}
v14 = -1073741670;
}
if( !v32 )
goto LABEL_32;
v46 = v32;
goto LABEL_31;
}
LABEL_32:
if( SegmentList )
RaspDestroySegmentList(SegmentList, (unsigned int)v13, v11);
return(unsigned int)v14;
}Referenced by:
RaspRasterize