BgpTxtDisplayCharacter

INT64 __fastcall BgpTxtDisplayCharacter(
        __int64 a1,
        unsigned __int16 a2,
        char a3,
        int *a4,
        _DWORD *a5,
        char a6,
        __int64 *a7){
  int v8; 
  INT64 v9; 
  __int64 v10; 
  unsigned int *v11; 
  __int64 v12; 
  char v13; 
  int v14; 
  int v15; 
  int *v16; 
  char v17; 
  INT64 *CacheEntry; 
  _CM_TRANS *v19; 
  INT64 result; 
  INT64 v21; 
  INT64 v22; 
  int v23; 
  void *v24; 
  void *v25; 
  unsigned int BitsPerPixel; 
  UINT64 *v27; 
  int v28; 
  _HHIVE **a5a; 
  UINT64 *a6a; 
  _CM_KEY_CONTROL_BLOCK **v31; 
  INT64 *a9; 
  int v33; 
  UINT64 a3a; 
  int a7a; 
  INT64 *v36; 
  int v37; 
  int v38; 
  INT64 a4a; 
  _DWORD v40[2]; 
  INT64 v41; 
  INT64 a2a; 
  __int64 v43; 
  char v48; 
  *(_QWORD *)v40 = 0i64;
  v8 = 0;
  v9 = 0i64;
  v43 = *(_QWORD *)(a1 + 24);
  v10 = 0i64;
  v33 = 0;
  a3a = 0i64;
  v11 = (unsigned int *)(a1 + 40);
  v12 = 0i64;
  v13 = *(_BYTE *)(a1 + 60) & 1;
  v37 = 0;
  v14 = 0;
  v38 = 0;
  v15 = 0;
  v16 = *(int **)(a1 + 32);
  v17 = v13;
  v36 = 0i64;
  a4a = 0i64;
  v41 = 0i64;
  v48 = 0;
  a2a = a1 + 40;
  a7a = 0;
  if( a2 < 0x20u )
    goto LABEL_12;
  if( v13 )
  {
    CacheEntry = TxtpGetCacheEntry(&TxtpTextCache, a2, (INT64)v11);
    v36 = CacheEntry;
    if( CacheEntry )
    {
      v9 = CacheEntry[6];
      v17 = 0;
      goto LABEL_5;
    }
  }
  BgpGxFillRectangle((INT64)v16, *v11);
  v21 = a2a;
  v38 = v16[1];
  v37 = *v16;
  LODWORD(a5a) = HIDWORD(a3a);
  v23 = BgpRasPrintGlyph(v22, a2a, a2, (unsigned int)a3a, (INT64)a5a, 1, &a7a, (INT64)a9, a7);
  v15 = v23;
  if( v23 < 0 )
  {
    LODWORD(a5a) = a2;
    DbgPrintEx(0x65u, 0, "BGFX internal font error %x char %x!\n", (unsigned int)v23, a5a);
    v14 = a7a;
    v8 = 0;
    v17 = v13;
    goto LABEL_11;
  }
  v14 = a7a;
  if( !v13 )
  {
    result = BgpFoGetTextMetrics(v21, v40);
    v15 = result;
    if( (int)result < 0 )
      return result;
    v33 = v40[1];
    *v16 = v40[1];
    v16[1] = v14;
    v48 = 1;
  }
  if( v43 )
  {
    TxtpJustifyRectangle((_DWORD *)a1, (_DWORD *)(a1 + 8), &a3a);
    v28 = BgpGxBlendRectangle(v27, v16, (INT64 *)&a3a, &a4a);
    v9 = a4a;
    v15 = v28;
    v17 = v13;
    if( v28 < 0 )
      goto LABEL_10;
  }
  else
  {
    v9 = (INT64)v16;
  }
  v17 = v13;
  if( !v13 )
    goto LABEL_5;
  BitsPerPixel = BgpGetBitsPerPixel(v25, v24);
  if( (int *)v9 != v16 && BitsPerPixel == *(_DWORD *)(v9 + 8) )
  {
    v12 = v9;
LABEL_5:
    HIDWORD(a3a) = *(_DWORD *)(a1 + 4);
    LODWORD(a3a) = *(_DWORD *)a1 + a3a;
    if( (a3 & 1) != 0
      || (dword_140C13310 & 0x1000000) != 0
      || (v15 = BgpGxDrawRectangle(
                  (_CM_KEY_CONTROL_BLOCK *)v9,
                  (_CM_KEY_CONTROL_BLOCK *)&a3a,
                  (UINT64)v11,
                  v19,
                  a5a,
                  a6a,
                  v31,
                  (UINT64 *)a9),
          v15 >= 0) )
    {
      if( v17 )
        v15 = TxtpAddCacheEntry((__int64 *)&TxtpTextCache, a2, a2a, v12);
    }
    goto LABEL_10;
  }
  v15 = BgpGxConvertRectangleEx(v9, BitsPerPixel, &v41, 0);
  if( v15 >= 0 )
  {
    if( (int *)v9 != v16 )
      BgpGxRectangleDestroy(v9);
    v12 = v41;
    v9 = v41;
    goto LABEL_5;
  }
LABEL_10:
  v8 = v33;
LABEL_11:
  v10 = (__int64)v36;
LABEL_12:
  if( a4 )
    *a4 = v14;
  if( a5 )
    *a5 = v8;
  if( (int *)v9 != v16 && !v10 && (!v17 || v15 < 0) && v9 )
    BgpGxRectangleDestroy(v9);
  if( v48 )
  {
    *v16 = v37;
    v16[1] = v38;
  }
  return(unsigned int)v15;
}

Referenced by:

AnFwDisplayProgressIndicator
AnFwpProgressAnimationManual
AnFwpProgressIndicatorTimer
BgpDisplayCharacterEx