Changeset 551 for trunk/dll/loadbmp.c


Ignore:
Timestamp:
Feb 28, 2007, 2:33:51 AM (19 years ago)
Author:
Gregg Young
Message:

Indentation cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/loadbmp.c

    r549 r551  
    4949  USHORT usType;
    5050  PBITMAPARRAYFILEHEADER2 pbmafh2 = NULL;       // Must init for xfree
    51   PBITMAPFILEHEADER2 pbmfh2;            // No color table
    52   PBITMAPINFOHEADER2 pbmih2;            // No color table
    53   PBITMAPINFO2 pbmi2;                   // Includes color table
    54   BOOL is2x;                            // Format 1.x or 2.x
     51  PBITMAPFILEHEADER2 pbmfh2;    // No color table
     52  PBITMAPINFOHEADER2 pbmih2;    // No color table
     53  PBITMAPINFO2 pbmi2;           // Includes color table
     54  BOOL is2x;                    // Format 1.x or 2.x
    5555  ULONG ulColors;
    5656  ULONG ulRGBOffset;
    57   PBYTE pData = NULL;                   // Must init for xfree
     57  PBYTE pData = NULL;           // Must init for xfree
    5858  ULONG ulDataSize;
    5959  SIZEL sizel;
     
    6161
    6262  if (!hPS) {
    63     Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
    64               "WinGetPS");
     63    Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, "WinGetPS");
    6564    goto ExitLoadBMP;
    6665  }
     
    8483     Allocate enough to hold a complete 2.x bitmap array file header
    8584     fixme to support > 256 colors?
    86   */
     85   */
    8786  pbmafh2 =
    8887    xmalloc(sizeof(*pbmafh2) + 256 * sizeof(RGB2), pszSrcFile, __LINE__);
     
    9291     Both the 1.x and 2.x structures are assigned to simplify code
    9392     fixme to clean this up - aliased pointers are evil
    94   */
     93   */
    9594  pbmfh2 = &pbmafh2->bfh2;
    9695  pbmih2 = &pbmfh2->bmp2;
    97   pbmi2 = (PBITMAPINFO2)pbmih2;
     96  pbmi2 = (PBITMAPINFO2) pbmih2;
    9897
    9998  switch (usType) {
     
    105104    {
    106105      /* Assume image is a 2.0 image and read as a 2.x header
    107         OK for 1.x file - read will not fail unless file is corrupted
    108       */
     106        OK for 1.x file - read will not fail unless file is corrupted
     107       */
    109108      rc = fseek(pf, 0, SEEK_SET);
    110109      if (rc) {
     
    121120      is2x = pbmih2->cbFix > sizeof(BITMAPINFOHEADER);  // 1.x or 2.x bitmap
    122121      /* We will read the color table later
    123         Color table follows header but
    124         location depends on the type of the bitmap (old vs new)
    125         1.x header is fixed size
    126         2.x header is variable sized, so offset must be calculated
    127         cbFix contains actual size of BITMAPINFOHEADER2 in file
    128       */
     122        Color table follows header but
     123        location depends on the type of the bitmap (old vs new)
     124        1.x header is fixed size
     125        2.x header is variable sized, so offset must be calculated
     126        cbFix contains actual size of BITMAPINFOHEADER2 in file
     127       */
    129128      ulRGBOffset = is2x ? sizeof(*pbmfh2) - sizeof(*pbmih2) + pbmih2->cbFix :
    130                            sizeof(BITMAPFILEHEADER);
     129        sizeof(BITMAPFILEHEADER);
    131130    }
    132131    break;
     
    135134    {
    136135      /* Now we are dealing with a bitmap array which is a collection of bitmaps
    137         Each bitmap has its own file header
    138       */
     136        Each bitmap has its own file header
     137       */
    139138
    140139      ULONG ulCurOffset;
     
    149148
    150149      /* Scan the array and chose the bitmap best suited
    151         for the current display size and color capacities
    152       */
     150        for the current display size and color capacities
     151       */
    153152      hdc = GpiQueryDevice(hPS);
    154153      if (!hdc) {
     
    157156        goto ExitLoadBMP;
    158157      }
    159       DevQueryCaps(hdc, CAPS_COLORS, 1, (PLONG)&ulDeviceColors);
    160       DevQueryCaps(hdc, CAPS_WIDTH, 1, (PLONG)&clScreenWidth);
    161       DevQueryCaps(hdc, CAPS_HEIGHT, 1, (PLONG)&clScreenHeight);
     158      DevQueryCaps(hdc, CAPS_COLORS, 1, (PLONG) & ulDeviceColors);
     159      DevQueryCaps(hdc, CAPS_WIDTH, 1, (PLONG) & clScreenWidth);
     160      DevQueryCaps(hdc, CAPS_HEIGHT, 1, (PLONG) & clScreenHeight);
    162161      pbmafh2->offNext = 0;
    163162      do {
     
    179178        }
    180179        else {
    181           ulColors = 1 << (((PBITMAPARRAYFILEHEADER)pbmafh2)->bfh.bmp.cBitCount *
    182                            ((PBITMAPARRAYFILEHEADER)pbmafh2)->bfh.bmp.cPlanes);
     180          ulColors =
     181            1 << (((PBITMAPARRAYFILEHEADER) pbmafh2)->bfh.bmp.cBitCount *
     182                  ((PBITMAPARRAYFILEHEADER) pbmafh2)->bfh.bmp.cPlanes);
    183183        }
    184184        if (pbmafh2->cxDisplay == 0 && pbmafh2->cyDisplay == 0) {
     
    188188        }
    189189        ulSizeDiff = abs(pbmafh2->cxDisplay - clScreenWidth) +
    190                      abs(pbmafh2->cyDisplay - clScreenHeight);
     190          abs(pbmafh2->cyDisplay - clScreenHeight);
    191191        if (ulDeviceColors == ulColors && ulSizeDiff == 0) {
    192192          // We found the perfect match
     
    197197            ulSizeDiff < ulSizeDiffPicked ||    // Better fit than any previous
    198198            (ulColors > ulColorsPicked && ulColors < ulDeviceColors) || // More colors than prev & less than device
    199             (ulColors < ulColorsPicked && ulColors > ulDeviceColors))
    200         {
     199            (ulColors < ulColorsPicked && ulColors > ulDeviceColors)) {
    201200          ulOffsetPicked = ulCurOffset; // Make this our current pick
    202201          ulColorsPicked = ulColors;
     
    219218      is2x = pbmih2->cbFix > sizeof(BITMAPINFOHEADER);
    220219      /* As before, we calculate offset in file stream to color table
    221         This code must match single bitmap logic
    222       */
     220        This code must match single bitmap logic
     221       */
    223222      ulRGBOffset = ulOffsetPicked;
    224       ulRGBOffset += is2x ? sizeof(*pbmafh2) - sizeof(*pbmih2) + pbmih2->cbFix :
    225                             sizeof(BITMAPARRAYFILEHEADER);
     223      ulRGBOffset +=
     224        is2x ? sizeof(*pbmafh2) - sizeof(*pbmih2) +
     225        pbmih2->cbFix : sizeof(BITMAPARRAYFILEHEADER);
    226226    }
    227227    break;
     
    246246       pbmih2->cclrUsed or pbmih2->cclrImportant are non zero
    247247       fixme to test this
    248     */
     248     */
    249249    if (pbmih2->cBitCount < 24) {
    250250      ULONG ulRGBBytes;
     251
    251252      ulColors = 1L << pbmih2->cBitCount;
    252253
    253254      if (ulColors > 256) {
    254         Runtime_Error(pszSrcFile, __LINE__, "RGB exceeds 256 colors: %lu", ulColors);
     255        Runtime_Error(pszSrcFile, __LINE__, "RGB exceeds 256 colors: %lu",
     256                      ulColors);
    255257        goto ExitLoadBMP;
    256258      }
     
    263265    }                                   // endif
    264266    // Get pointer to bitmap info (header and color table)
    265     pbmi2 = (PBITMAPINFO2)pbmih2;
     267    pbmi2 = (PBITMAPINFO2) pbmih2;
    266268  }
    267269  else {
     
    269271       Since the current standard format is the 2.0
    270272       convert the header and color table to 2.x format
    271     */
     273     */
    272274    ULONG ul;
    273275    RGB rgb;
    274     PBITMAPINFOHEADER pbmih = &((PBITMAPARRAYFILEHEADER)pbmafh2)->bfh.bmp;
     276    PBITMAPINFOHEADER pbmih = &((PBITMAPARRAYFILEHEADER) pbmafh2)->bfh.bmp;
    275277
    276278    if (pbmih->cBitCount < 24) {
    277279      ulColors = 1 << pbmih->cBitCount;
    278280      if (ulColors > 256) {
    279         Runtime_Error(pszSrcFile, __LINE__, "RGB exceeds 256 colors: %lu", ulColors);
     281        Runtime_Error(pszSrcFile, __LINE__, "RGB exceeds 256 colors: %lu",
     282                      ulColors);
    280283        goto ExitLoadBMP;
    281284      }
     
    287290        pbmi2->argbColor[ul].bBlue = rgb.bBlue;
    288291        pbmi2->argbColor[ul].fcOptions = 0;     // initialize 2.x extra byte to 0
    289       } // for
     292      }                                 // for
    290293    }
    291294
     
    297300    pbmi2->cx = pbmih->cx;
    298301    // set rest to zero
    299     memset((PCHAR)pbmi2 + 16, 0, sizeof(BITMAPINFOHEADER2) - 16);
    300   } // if 1.x
     302    memset((PCHAR) pbmi2 + 16, 0, sizeof(BITMAPINFOHEADER2) - 16);
     303  }                                     // if 1.x
    301304
    302305  /* The 2.0 bitmap info structure set up
    303306     Position to start of the bitmap data
    304   */
     307   */
    305308  rc = fseek(pf, pbmfh2->offBits, SEEK_SET);
    306309  if (rc) {
     
    315318     After aligning it, we divide by 4 to get the number of bytes, and
    316319     multiply by the number of scan lines and the number of pel planes
    317   */
     320   */
    318321  if (pbmi2->ulCompression)
    319322    ulDataSize = pbmi2->cbImage;
Note: See TracChangeset for help on using the changeset viewer.