Newer
Older
AMI-Aptio-BIOS-Reversed / PurleyPlatPkg / Platform / Pei / EarlyVideoPei / BitmapRender.c
@Ajax Dong Ajax Dong 2 days ago 997 bytes Full restructure
int __fastcall BitmapRender(char *i, int *Pool, int a3, int a4)
{
  int v5; // eax
  char n48; // cl
  char *i_1; // eax
  int count; // esi
  int BitsPerPixel; // eax
  int v12; // [esp+10h] [ebp-4h]
  int v13; // [esp+10h] [ebp-4h]

  v5 = 0;
  if ( *Pool > 9 )
  {
    LOBYTE(v5) = *Pool > 26;
    ++v5;
  }
  n48 = *i;
  v12 = *(_DWORD *)(a4 + 4 * v5 + 128);
  i_1 = i;
  while ( n48 >= 48 && n48 <= 57 )
    n48 = *++i_1;
  count = i_1 - i;
  if ( *i_1 )
  {
    BitsPerPixel = BitmapGetBitsPerPixel(a4, *i_1);
    if ( BitsPerPixel == 2 )
    {
      if ( v12 - 8 * count + BitmapGetImageSize(count) + 4 > 0 )
        return BitmapDecodePixels(i, Pool, 8 * count, a4);
    }
    else if ( BitsPerPixel == 1 )
    {
      v13 = v12 - BitmapGetDataOffset(count + 1);
      if ( v13 + BitmapGetImageSize(count) + 10 > 0 )
        return BitmapDecodeFull(i, Pool, v13, a4);
    }
  }
  if ( BitmapDecodePalette((int)Pool, 0, (void *)count, i, a4) >= 0 )
    return count;
  else
    return -1;
}