Newer
Older
AMI-Aptio-BIOS-Reversed / PurleyPlatPkg / Platform / Pei / EarlyVideoPei / BitmapDecodePixels.c
@Ajax Dong Ajax Dong 2 days ago 1 KB Full restructure
int __fastcall BitmapDecodePixels(char *i, int *Pool, int a3, int a4)
{
  int *Pool_1; // edi
  char *i_1; // ebp
  int v6; // eax
  int v7; // ecx
  int v8; // eax
  char *j_1; // esi
  char v10; // dl
  int v11; // ebp
  int BitsPerPixel; // eax
  char n48; // dl
  char *j; // edi
  int ImageSize; // eax
  int v16; // ecx
  int v17; // eax
  int DataOffset; // eax
  void *count; // esi
  int v21; // [esp+14h] [ebp-Ch]

  Pool_1 = Pool;
  i_1 = i;
  v6 = 0;
  if ( *Pool > 9 )
    v7 = (*Pool > 26) + 1;
  else
    v7 = 0;
  v21 = *(_DWORD *)(a4 + 4 * v7 + 140);
  if ( *Pool > 9 )
    v6 = (*Pool > 26) + 1;
  v8 = *(_DWORD *)(a4 + 4 * v6 + 128);
  j_1 = i_1 + 1;
  v10 = i_1[1];
  if ( v10 )
  {
    v11 = v8;
    while ( 1 )
    {
      BitsPerPixel = BitmapGetBitsPerPixel(a4, v10);
      if ( BitsPerPixel == 3 )
      {
LABEL_25:
        i_1 = i;
        Pool_1 = Pool;
        goto LABEL_26;
      }
      if ( !BitsPerPixel )
        break;
      if ( BitsPerPixel == 1 )
      {
        for ( j = j_1; *j >= 0 && *(char *)(*j + a4) >= 0; ++j )
          ;
        DataOffset = BitmapGetDataOffset(j - j_1);
        v16 = j_1 - j;
        v17 = v21 + DataOffset;
        goto LABEL_21;
      }
      ++j_1;
LABEL_24:
      v10 = *j_1;
      if ( !*j_1 )
        goto LABEL_25;
    }
    j = j_1;
    while ( n48 >= 48 && n48 <= 57 )
      n48 = *++j;
    ImageSize = BitmapGetImageSize(j - j_1);
    v16 = j_1 - j;
    v17 = v11 + ImageSize;
LABEL_21:
    if ( v17 + 8 * v16 + 4 < 0 )
      goto LABEL_25;
    j_1 = j;
    goto LABEL_24;
  }
LABEL_26:
  count = (void *)(j_1 - i_1);
  if ( BitmapDecodePalette((int)Pool_1, 2, count, i_1, a4) >= 0 )
    return (int)count;
  else
    return -1;
}