| [351] | 1 |  | 
|---|
|  | 2 | /*********************************************************************** | 
|---|
|  | 3 |  | 
|---|
|  | 4 | $Id: loadbmp.c 551 2007-02-28 01:33:51Z gyoung $ | 
|---|
|  | 5 |  | 
|---|
|  | 6 | Load bitmaps | 
|---|
|  | 7 |  | 
|---|
|  | 8 | Copyright (c) 1993-98 M. Kimes | 
|---|
| [549] | 9 | Copyright (c) 2006, 2007 Steven H.Levine | 
|---|
| [351] | 10 |  | 
|---|
|  | 11 | 22 Jul 06 SHL Check more run time errors | 
|---|
| [549] | 12 | 16 Jan 07 SHL Check more run time errors | 
|---|
|  | 13 | 16 Jan 07 SHL Sync variable names for sanity | 
|---|
|  | 14 | 16 Jan 07 SHL Open bitmap file binary - no wonder the code does not work | 
|---|
|  | 15 | 16 Jan 07 SHL Beautify with indent -i2 | 
|---|
| [351] | 16 |  | 
|---|
|  | 17 | ***********************************************************************/ | 
|---|
|  | 18 |  | 
|---|
| [2] | 19 | #define INCL_DOS | 
|---|
|  | 20 | #define INCL_WIN | 
|---|
|  | 21 | #define INCL_GPI | 
|---|
| [351] | 22 | #include <os2.h> | 
|---|
| [2] | 23 |  | 
|---|
|  | 24 | #include <stdlib.h> | 
|---|
|  | 25 | #include <stdio.h> | 
|---|
|  | 26 | #include <string.h> | 
|---|
|  | 27 | #include <share.h> | 
|---|
| [351] | 28 |  | 
|---|
| [2] | 29 | #include "fm3dll.h" | 
|---|
|  | 30 |  | 
|---|
| [351] | 31 | static PSZ pszSrcFile = __FILE__; | 
|---|
|  | 32 |  | 
|---|
| [2] | 33 | #pragma alloc_text(LOADBITMAP,LoadBitmapFromFile,LoadBitmapFromFileNum) | 
|---|
|  | 34 |  | 
|---|
| [549] | 35 | HBITMAP LoadBitmapFromFileNum(USHORT id) | 
|---|
| [351] | 36 | { | 
|---|
| [549] | 37 | char s[CCHMAXPATH]; | 
|---|
| [2] | 38 |  | 
|---|
|  | 39 | save_dir2(s); | 
|---|
| [549] | 40 | sprintf(s + strlen(s), "\\%u.BMP", id); | 
|---|
| [2] | 41 | return LoadBitmapFromFile(s); | 
|---|
|  | 42 | } | 
|---|
|  | 43 |  | 
|---|
| [549] | 44 | HBITMAP LoadBitmapFromFile(CHAR * pszFileName) | 
|---|
| [351] | 45 | { | 
|---|
| [549] | 46 | HBITMAP hBmp = (HBITMAP) 0; | 
|---|
|  | 47 | FILE *pf; | 
|---|
|  | 48 | ULONG rc; | 
|---|
|  | 49 | USHORT usType; | 
|---|
|  | 50 | PBITMAPARRAYFILEHEADER2 pbmafh2 = NULL;       // Must init for xfree | 
|---|
| [551] | 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 | 
|---|
| [549] | 55 | ULONG ulColors; | 
|---|
|  | 56 | ULONG ulRGBOffset; | 
|---|
| [551] | 57 | PBYTE pData = NULL;           // Must init for xfree | 
|---|
| [549] | 58 | ULONG ulDataSize; | 
|---|
|  | 59 | SIZEL sizel; | 
|---|
|  | 60 | HPS hPS = WinGetPS(HWND_DESKTOP); | 
|---|
| [2] | 61 |  | 
|---|
| [549] | 62 | if (!hPS) { | 
|---|
| [551] | 63 | Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, "WinGetPS"); | 
|---|
| [2] | 64 | goto ExitLoadBMP; | 
|---|
| [549] | 65 | } | 
|---|
| [2] | 66 |  | 
|---|
| [549] | 67 | pf = _fsopen(pszFileName, "rb", SH_DENYWR); | 
|---|
|  | 68 | if (!pf) { | 
|---|
|  | 69 | // OK for file to not exist - enable following for debug as needed | 
|---|
|  | 70 | // Runtime_Error(pszSrcFile, __LINE__, "_fsopen %s", pszFileName); | 
|---|
| [2] | 71 | goto ExitLoadBMP; | 
|---|
| [549] | 72 | } | 
|---|
| [2] | 73 |  | 
|---|
| [549] | 74 | // Read image type | 
|---|
|  | 75 | // fixme to just read type2 header - this is silly and wastes time | 
|---|
|  | 76 | rc = fread(&usType, 1, sizeof(usType), pf); | 
|---|
|  | 77 | if (rc != sizeof(usType)) { | 
|---|
|  | 78 | Runtime_Error(pszSrcFile, __LINE__, "fread"); | 
|---|
| [2] | 79 | goto ExitLoadBMP; | 
|---|
| [549] | 80 | } | 
|---|
|  | 81 |  | 
|---|
|  | 82 | /* Read bitmap info header | 
|---|
|  | 83 | Allocate enough to hold a complete 2.x bitmap array file header | 
|---|
|  | 84 | fixme to support > 256 colors? | 
|---|
| [551] | 85 | */ | 
|---|
| [549] | 86 | pbmafh2 = | 
|---|
|  | 87 | xmalloc(sizeof(*pbmafh2) + 256 * sizeof(RGB2), pszSrcFile, __LINE__); | 
|---|
|  | 88 | if (!pbmafh2) | 
|---|
|  | 89 | goto ExitLoadBMP; | 
|---|
|  | 90 | /* Assign pointers to the file header and bitmap info header etc. | 
|---|
|  | 91 | Both the 1.x and 2.x structures are assigned to simplify code | 
|---|
|  | 92 | fixme to clean this up - aliased pointers are evil | 
|---|
| [551] | 93 | */ | 
|---|
| [549] | 94 | pbmfh2 = &pbmafh2->bfh2; | 
|---|
|  | 95 | pbmih2 = &pbmfh2->bmp2; | 
|---|
| [551] | 96 | pbmi2 = (PBITMAPINFO2) pbmih2; | 
|---|
| [549] | 97 |  | 
|---|
| [2] | 98 | switch (usType) { | 
|---|
| [549] | 99 | case BFT_BMAP: | 
|---|
|  | 100 | case BFT_ICON: | 
|---|
|  | 101 | case BFT_POINTER: | 
|---|
|  | 102 | case BFT_COLORICON: | 
|---|
|  | 103 | case BFT_COLORPOINTER: | 
|---|
|  | 104 | { | 
|---|
|  | 105 | /* Assume image is a 2.0 image and read as a 2.x header | 
|---|
| [551] | 106 | OK for 1.x file - read will not fail unless file is corrupted | 
|---|
|  | 107 | */ | 
|---|
| [549] | 108 | rc = fseek(pf, 0, SEEK_SET); | 
|---|
|  | 109 | if (rc) { | 
|---|
|  | 110 | Runtime_Error(pszSrcFile, __LINE__, "fseek 0"); | 
|---|
|  | 111 | goto ExitLoadBMP; | 
|---|
|  | 112 | } | 
|---|
| [2] | 113 |  | 
|---|
| [549] | 114 | rc = fread(pbmfh2, 1, sizeof(*pbmfh2), pf); | 
|---|
|  | 115 | if (rc != sizeof(*pbmfh2)) { | 
|---|
|  | 116 | Runtime_Error(pszSrcFile, __LINE__, "fread"); | 
|---|
|  | 117 | goto ExitLoadBMP; | 
|---|
| [2] | 118 | } | 
|---|
|  | 119 |  | 
|---|
| [549] | 120 | is2x = pbmih2->cbFix > sizeof(BITMAPINFOHEADER);  // 1.x or 2.x bitmap | 
|---|
|  | 121 | /* We will read the color table later | 
|---|
| [551] | 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 | */ | 
|---|
| [549] | 128 | ulRGBOffset = is2x ? sizeof(*pbmfh2) - sizeof(*pbmih2) + pbmih2->cbFix : | 
|---|
| [551] | 129 | sizeof(BITMAPFILEHEADER); | 
|---|
| [549] | 130 | } | 
|---|
|  | 131 | break; | 
|---|
| [2] | 132 |  | 
|---|
| [549] | 133 | case BFT_BITMAPARRAY: | 
|---|
|  | 134 | { | 
|---|
|  | 135 | /* Now we are dealing with a bitmap array which is a collection of bitmaps | 
|---|
| [551] | 136 | Each bitmap has its own file header | 
|---|
|  | 137 | */ | 
|---|
| [2] | 138 |  | 
|---|
| [549] | 139 | ULONG ulCurOffset; | 
|---|
|  | 140 | ULONG clScreenWidth; | 
|---|
|  | 141 | ULONG clScreenHeight; | 
|---|
|  | 142 | ULONG ulDeviceColors; | 
|---|
|  | 143 | ULONG ulSizeDiff; | 
|---|
|  | 144 | ULONG ulOffsetPicked = 0; | 
|---|
|  | 145 | ULONG ulColorsPicked; | 
|---|
|  | 146 | ULONG ulSizeDiffPicked; | 
|---|
|  | 147 | HDC hdc; | 
|---|
| [2] | 148 |  | 
|---|
| [549] | 149 | /* Scan the array and chose the bitmap best suited | 
|---|
| [551] | 150 | for the current display size and color capacities | 
|---|
|  | 151 | */ | 
|---|
| [549] | 152 | hdc = GpiQueryDevice(hPS); | 
|---|
|  | 153 | if (!hdc) { | 
|---|
|  | 154 | Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, | 
|---|
|  | 155 | "GpiQueryDevice"); | 
|---|
|  | 156 | goto ExitLoadBMP; | 
|---|
|  | 157 | } | 
|---|
| [551] | 158 | DevQueryCaps(hdc, CAPS_COLORS, 1, (PLONG) & ulDeviceColors); | 
|---|
|  | 159 | DevQueryCaps(hdc, CAPS_WIDTH, 1, (PLONG) & clScreenWidth); | 
|---|
|  | 160 | DevQueryCaps(hdc, CAPS_HEIGHT, 1, (PLONG) & clScreenHeight); | 
|---|
| [549] | 161 | pbmafh2->offNext = 0; | 
|---|
|  | 162 | do { | 
|---|
|  | 163 | ulCurOffset = pbmafh2->offNext; | 
|---|
|  | 164 | rc = fseek(pf, pbmafh2->offNext, SEEK_SET); | 
|---|
|  | 165 | if (rc) { | 
|---|
|  | 166 | Runtime_Error(pszSrcFile, __LINE__, "fseek %ld", pbmafh2->offNext); | 
|---|
|  | 167 | goto ExitLoadBMP; | 
|---|
|  | 168 | } | 
|---|
|  | 169 | rc = fread(pbmafh2, 1, sizeof(*pbmafh2), pf); | 
|---|
|  | 170 | if (rc != sizeof(*pbmafh2)) { | 
|---|
|  | 171 | Runtime_Error(pszSrcFile, __LINE__, "fread"); | 
|---|
|  | 172 | goto ExitLoadBMP; | 
|---|
|  | 173 | } | 
|---|
|  | 174 | is2x = pbmih2->cbFix > sizeof(BITMAPINFOHEADER); | 
|---|
|  | 175 | if (is2x) { | 
|---|
|  | 176 | ulColors = 1 << (pbmafh2->bfh2.bmp2.cBitCount * | 
|---|
|  | 177 | pbmafh2->bfh2.bmp2.cPlanes); | 
|---|
|  | 178 | } | 
|---|
|  | 179 | else { | 
|---|
| [551] | 180 | ulColors = | 
|---|
|  | 181 | 1 << (((PBITMAPARRAYFILEHEADER) pbmafh2)->bfh.bmp.cBitCount * | 
|---|
|  | 182 | ((PBITMAPARRAYFILEHEADER) pbmafh2)->bfh.bmp.cPlanes); | 
|---|
| [549] | 183 | } | 
|---|
|  | 184 | if (pbmafh2->cxDisplay == 0 && pbmafh2->cyDisplay == 0) { | 
|---|
|  | 185 | // This is a device independant bitmap - process it as a VGA | 
|---|
|  | 186 | pbmafh2->cxDisplay = 640; | 
|---|
|  | 187 | pbmafh2->cyDisplay = 480; | 
|---|
|  | 188 | } | 
|---|
|  | 189 | ulSizeDiff = abs(pbmafh2->cxDisplay - clScreenWidth) + | 
|---|
| [551] | 190 | abs(pbmafh2->cyDisplay - clScreenHeight); | 
|---|
| [549] | 191 | if (ulDeviceColors == ulColors && ulSizeDiff == 0) { | 
|---|
|  | 192 | // We found the perfect match | 
|---|
|  | 193 | ulOffsetPicked = ulCurOffset; | 
|---|
|  | 194 | break;                        // Stop scan | 
|---|
|  | 195 | } | 
|---|
|  | 196 | if (ulOffsetPicked == 0 ||      // First time thru | 
|---|
|  | 197 | ulSizeDiff < ulSizeDiffPicked ||    // Better fit than any previous | 
|---|
|  | 198 | (ulColors > ulColorsPicked && ulColors < ulDeviceColors) || // More colors than prev & less than device | 
|---|
| [551] | 199 | (ulColors < ulColorsPicked && ulColors > ulDeviceColors)) { | 
|---|
| [549] | 200 | ulOffsetPicked = ulCurOffset; // Make this our current pick | 
|---|
|  | 201 | ulColorsPicked = ulColors; | 
|---|
|  | 202 | ulSizeDiffPicked = ulSizeDiff; | 
|---|
|  | 203 | } | 
|---|
|  | 204 | } while (pbmafh2->offNext != 0); | 
|---|
| [2] | 205 |  | 
|---|
| [549] | 206 | // Retrieve the selected bitmap | 
|---|
|  | 207 | rc = fseek(pf, ulOffsetPicked, SEEK_SET); | 
|---|
|  | 208 | if (rc) { | 
|---|
|  | 209 | Runtime_Error(pszSrcFile, __LINE__, "fseek %ld", ulOffsetPicked); | 
|---|
|  | 210 | goto ExitLoadBMP; | 
|---|
| [2] | 211 | } | 
|---|
| [549] | 212 | rc = fread(pbmafh2, 1, sizeof(*pbmafh2), pf); | 
|---|
|  | 213 | if (rc != sizeof(*pbmafh2)) { | 
|---|
|  | 214 | Runtime_Error(pszSrcFile, __LINE__, "fread"); | 
|---|
|  | 215 | goto ExitLoadBMP; | 
|---|
|  | 216 | } | 
|---|
| [2] | 217 |  | 
|---|
| [549] | 218 | is2x = pbmih2->cbFix > sizeof(BITMAPINFOHEADER); | 
|---|
|  | 219 | /* As before, we calculate offset in file stream to color table | 
|---|
| [551] | 220 | This code must match single bitmap logic | 
|---|
|  | 221 | */ | 
|---|
| [549] | 222 | ulRGBOffset = ulOffsetPicked; | 
|---|
| [551] | 223 | ulRGBOffset += | 
|---|
|  | 224 | is2x ? sizeof(*pbmafh2) - sizeof(*pbmih2) + | 
|---|
|  | 225 | pbmih2->cbFix : sizeof(BITMAPARRAYFILEHEADER); | 
|---|
| [549] | 226 | } | 
|---|
|  | 227 | break; | 
|---|
| [2] | 228 |  | 
|---|
| [549] | 229 | default: | 
|---|
|  | 230 | Runtime_Error(pszSrcFile, __LINE__, "Bad type %u", usType); | 
|---|
| [2] | 231 | goto ExitLoadBMP; | 
|---|
| [549] | 232 | }                                     // endswitch | 
|---|
| [2] | 233 |  | 
|---|
| [549] | 234 | // Position to color table | 
|---|
|  | 235 | rc = fseek(pf, ulRGBOffset, SEEK_SET); | 
|---|
|  | 236 | if (rc) { | 
|---|
|  | 237 | Runtime_Error(pszSrcFile, __LINE__, "fseek %ld", ulRGBOffset); | 
|---|
|  | 238 | goto ExitLoadBMP; | 
|---|
|  | 239 | } | 
|---|
| [2] | 240 |  | 
|---|
| [549] | 241 | // Read color table | 
|---|
|  | 242 | if (is2x) { | 
|---|
|  | 243 | /* For a 2.0 bitmap, read the color table as is | 
|---|
|  | 244 | The bitmap info structure is header + color table | 
|---|
|  | 245 | If we have 24 bits per pel, there is usually no color table, unless | 
|---|
|  | 246 | pbmih2->cclrUsed or pbmih2->cclrImportant are non zero | 
|---|
|  | 247 | fixme to test this | 
|---|
| [551] | 248 | */ | 
|---|
| [549] | 249 | if (pbmih2->cBitCount < 24) { | 
|---|
|  | 250 | ULONG ulRGBBytes; | 
|---|
| [551] | 251 |  | 
|---|
| [549] | 252 | ulColors = 1L << pbmih2->cBitCount; | 
|---|
| [2] | 253 |  | 
|---|
| [549] | 254 | if (ulColors > 256) { | 
|---|
| [551] | 255 | Runtime_Error(pszSrcFile, __LINE__, "RGB exceeds 256 colors: %lu", | 
|---|
|  | 256 | ulColors); | 
|---|
| [549] | 257 | goto ExitLoadBMP; | 
|---|
|  | 258 | } | 
|---|
|  | 259 | ulRGBBytes = ulColors * sizeof(RGB2); | 
|---|
|  | 260 | rc = fread(&pbmi2->argbColor[0], 1, ulRGBBytes, pf); | 
|---|
|  | 261 | if (rc != ulRGBBytes) { | 
|---|
|  | 262 | Runtime_Error(pszSrcFile, __LINE__, "fread"); | 
|---|
|  | 263 | goto ExitLoadBMP; | 
|---|
|  | 264 | } | 
|---|
|  | 265 | }                                   // endif | 
|---|
|  | 266 | // Get pointer to bitmap info (header and color table) | 
|---|
| [551] | 267 | pbmi2 = (PBITMAPINFO2) pbmih2; | 
|---|
| [2] | 268 | } | 
|---|
|  | 269 | else { | 
|---|
| [549] | 270 | /* This is a 1.x format bitmap | 
|---|
|  | 271 | Since the current standard format is the 2.0 | 
|---|
|  | 272 | convert the header and color table to 2.x format | 
|---|
| [551] | 273 | */ | 
|---|
| [549] | 274 | ULONG ul; | 
|---|
|  | 275 | RGB rgb; | 
|---|
| [551] | 276 | PBITMAPINFOHEADER pbmih = &((PBITMAPARRAYFILEHEADER) pbmafh2)->bfh.bmp; | 
|---|
| [2] | 277 |  | 
|---|
| [549] | 278 | if (pbmih->cBitCount < 24) { | 
|---|
|  | 279 | ulColors = 1 << pbmih->cBitCount; | 
|---|
|  | 280 | if (ulColors > 256) { | 
|---|
| [551] | 281 | Runtime_Error(pszSrcFile, __LINE__, "RGB exceeds 256 colors: %lu", | 
|---|
|  | 282 | ulColors); | 
|---|
| [549] | 283 | goto ExitLoadBMP; | 
|---|
|  | 284 | } | 
|---|
|  | 285 | // Read in 1.x color table and reformat for 2.x | 
|---|
|  | 286 | for (ul = 0; ul < ulColors; ul++) { | 
|---|
|  | 287 | fread(&rgb, 1, sizeof(rgb), pf); | 
|---|
|  | 288 | pbmi2->argbColor[ul].bRed = rgb.bRed; | 
|---|
|  | 289 | pbmi2->argbColor[ul].bGreen = rgb.bGreen; | 
|---|
|  | 290 | pbmi2->argbColor[ul].bBlue = rgb.bBlue; | 
|---|
|  | 291 | pbmi2->argbColor[ul].fcOptions = 0;     // initialize 2.x extra byte to 0 | 
|---|
| [551] | 292 | }                                 // for | 
|---|
| [549] | 293 | } | 
|---|
| [2] | 294 |  | 
|---|
| [549] | 295 | // Convert the old style to the new header format | 
|---|
|  | 296 | pbmi2->cbFix = sizeof(BITMAPINFOHEADER2); | 
|---|
|  | 297 | pbmi2->cBitCount = pbmih->cBitCount; | 
|---|
|  | 298 | pbmi2->cPlanes = pbmih->cPlanes; | 
|---|
|  | 299 | pbmi2->cy = pbmih->cy; | 
|---|
|  | 300 | pbmi2->cx = pbmih->cx; | 
|---|
| [2] | 301 | // set rest to zero | 
|---|
| [551] | 302 | memset((PCHAR) pbmi2 + 16, 0, sizeof(BITMAPINFOHEADER2) - 16); | 
|---|
|  | 303 | }                                     // if 1.x | 
|---|
| [2] | 304 |  | 
|---|
| [549] | 305 | /* The 2.0 bitmap info structure set up | 
|---|
|  | 306 | Position to start of the bitmap data | 
|---|
| [551] | 307 | */ | 
|---|
| [549] | 308 | rc = fseek(pf, pbmfh2->offBits, SEEK_SET); | 
|---|
|  | 309 | if (rc) { | 
|---|
|  | 310 | Runtime_Error(pszSrcFile, __LINE__, "fseek %ld", pbmfh2->offBits); | 
|---|
| [2] | 311 | goto ExitLoadBMP; | 
|---|
| [549] | 312 | } | 
|---|
| [2] | 313 |  | 
|---|
| [549] | 314 | /* Read the bitmap data | 
|---|
|  | 315 | The read size is derived using the magic formula | 
|---|
|  | 316 | Each bitmap scan line is aligned on a doubleword boundary | 
|---|
|  | 317 | The size of the scan line is the number of pels times the bpp | 
|---|
|  | 318 | After aligning it, we divide by 4 to get the number of bytes, and | 
|---|
|  | 319 | multiply by the number of scan lines and the number of pel planes | 
|---|
| [551] | 320 | */ | 
|---|
| [549] | 321 | if (pbmi2->ulCompression) | 
|---|
| [2] | 322 | ulDataSize = pbmi2->cbImage; | 
|---|
|  | 323 | else | 
|---|
|  | 324 | ulDataSize = (((pbmi2->cBitCount * pbmi2->cx) + 31) / 32) * 4 * | 
|---|
| [549] | 325 | pbmi2->cy * pbmi2->cPlanes; | 
|---|
|  | 326 | pData = xmalloc(ulDataSize, pszSrcFile, __LINE__); | 
|---|
|  | 327 | if (!pData) | 
|---|
| [2] | 328 | goto ExitLoadBMP; | 
|---|
| [549] | 329 | rc = fread(pData, 1, ulDataSize, pf); | 
|---|
|  | 330 | if (rc != ulDataSize) { | 
|---|
|  | 331 | Runtime_Error(pszSrcFile, __LINE__, "fread"); | 
|---|
| [2] | 332 | goto ExitLoadBMP; | 
|---|
| [549] | 333 | } | 
|---|
| [2] | 334 |  | 
|---|
| [549] | 335 | // Create the GPI bitmap image | 
|---|
| [2] | 336 | sizel.cx = pbmi2->cx; | 
|---|
|  | 337 | sizel.cy = pbmi2->cy; | 
|---|
|  | 338 |  | 
|---|
| [549] | 339 | hBmp = GpiCreateBitmap(hPS, (PBITMAPINFOHEADER2) pbmi2, CBM_INIT, | 
|---|
|  | 340 | pData, pbmi2); | 
|---|
|  | 341 | if (!hBmp) | 
|---|
|  | 342 | Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, | 
|---|
|  | 343 | "GpiCreateBitmap"); | 
|---|
| [2] | 344 |  | 
|---|
|  | 345 | ExitLoadBMP: | 
|---|
| [351] | 346 |  | 
|---|
|  | 347 | xfree(pData); | 
|---|
| [549] | 348 | xfree(pbmafh2); | 
|---|
|  | 349 | if (pf) | 
|---|
|  | 350 | fclose(pf); | 
|---|
|  | 351 | if (hPS) | 
|---|
|  | 352 | WinReleasePS(hPS); | 
|---|
| [351] | 353 | return hBmp; | 
|---|
| [2] | 354 | } | 
|---|