Changeset 1673 for trunk/dll/loadbmp.c
- Timestamp:
- Dec 30, 2012, 7:51:01 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/loadbmp.c
r1544 r1673 96 96 } 97 97 98 /* Read bitmap info header 99 Allocate enough to hold a complete 2.x bitmap array file header 100 fixme to support > 256 colors? 98 /** 99 * Read bitmap info header 100 * Allocate enough to hold a complete 2.x bitmap array file header 101 * fixme to support > 256 colors? 101 102 */ 102 103 pbmafh2 = … … 104 105 if (!pbmafh2) 105 106 goto ExitLoadBMP; 106 /* Assign pointers to the file header and bitmap info header etc. 107 Both the 1.x and 2.x structures are assigned to simplify code 108 fixme to clean this up - aliased pointers are evil 107 /** 108 * Assign pointers to the file header and bitmap info header etc. 109 * Both the 1.x and 2.x structures are assigned to simplify code 110 * fixme to clean this up - aliased pointers are evil 109 111 */ 110 112 pbmfh2 = &pbmafh2->bfh2; … … 119 121 case BFT_COLORPOINTER: 120 122 { 121 /* Assume image is a 2.0 image and read as a 2.x header 122 OK for 1.x file - read will not fail unless file is corrupted 123 /** 124 * Assume image is a 2.0 image and read as a 2.x header 125 * OK for 1.x file - read will not fail unless file is corrupted 123 126 */ 124 127 rc = fseek(pf, 0, SEEK_SET); … … 135 138 136 139 is2x = pbmih2->cbFix > sizeof(BITMAPINFOHEADER); // 1.x or 2.x bitmap 137 /* We will read the color table later 138 Color table follows header but 139 location depends on the type of the bitmap (old vs new) 140 1.x header is fixed size 141 2.x header is variable sized, so offset must be calculated 142 cbFix contains actual size of BITMAPINFOHEADER2 in file 140 /** 141 * We will read the color table later 142 * Color table follows header but 143 * location depends on the type of the bitmap (old vs new) 144 * 1.x header is fixed size 145 * 2.x header is variable sized, so offset must be calculated 146 * cbFix contains actual size of BITMAPINFOHEADER2 in file 143 147 */ 144 148 ulRGBOffset = is2x ? sizeof(*pbmfh2) - sizeof(*pbmih2) + pbmih2->cbFix : … … 149 153 case BFT_BITMAPARRAY: 150 154 { 151 /* Now we are dealing with a bitmap array which is a collection of bitmaps 152 Each bitmap has its own file header 155 /** 156 * Now we are dealing with a bitmap array which is a collection of bitmaps 157 * Each bitmap has its own file header 153 158 */ 154 159 … … 163 168 HDC hdc; 164 169 165 /* Scan the array and chose the bitmap best suited 166 for the current display size and color capacities 170 /** 171 * Scan the array and chose the bitmap best suited 172 * for the current display size and color capacities 167 173 */ 168 174 hdc = GpiQueryDevice(hPS); … … 233 239 234 240 is2x = pbmih2->cbFix > sizeof(BITMAPINFOHEADER); 235 /* As before, we calculate offset in file stream to color table 236 This code must match single bitmap logic 241 /** 242 * As before, we calculate offset in file stream to color table 243 * This code must match single bitmap logic 237 244 */ 238 245 ulRGBOffset = ulOffsetPicked; … … 257 264 // Read color table 258 265 if (is2x) { 259 /* For a 2.0 bitmap, read the color table as is 260 The bitmap info structure is header + color table 261 If we have 24 bits per pel, there is usually no color table, unless 262 pbmih2->cclrUsed or pbmih2->cclrImportant are non zero 263 fixme to test this 266 /** 267 * For a 2.0 bitmap, read the color table as is 268 * The bitmap info structure is header + color table 269 * If we have 24 bits per pel, there is usually no color table, unless 270 * pbmih2->cclrUsed or pbmih2->cclrImportant are non zero 271 * fixme to test this 264 272 */ 265 273 if (pbmih2->cBitCount < 24) { … … 284 292 } 285 293 else { 286 /* This is a 1.x format bitmap 287 Since the current standard format is the 2.0 288 convert the header and color table to 2.x format 294 /** 295 * This is a 1.x format bitmap 296 * Since the current standard format is the 2.0 297 * convert the header and color table to 2.x format 289 298 */ 290 299 ULONG ul; … … 319 328 } // if 1.x 320 329 321 /* The 2.0 bitmap info structure set up 322 Position to start of the bitmap data 330 /** 331 * The 2.0 bitmap info structure set up 332 * Position to start of the bitmap data 323 333 */ 324 334 rc = fseek(pf, pbmfh2->offBits, SEEK_SET); … … 328 338 } 329 339 330 /* Read the bitmap data 331 The read size is derived using the magic formula 332 Each bitmap scan line is aligned on a doubleword boundary 333 The size of the scan line is the number of pels times the bpp 334 After aligning it, we divide by 4 to get the number of bytes, and 335 multiply by the number of scan lines and the number of pel planes 340 /** 341 * Read the bitmap data 342 * The read size is derived using the magic formula 343 * Each bitmap scan line is aligned on a doubleword boundary 344 * The size of the scan line is the number of pels times the bpp 345 * After aligning it, we divide by 4 to get the number of bytes, and 346 * multiply by the number of scan lines and the number of pel planes 336 347 */ 337 348 if (pbmi2->ulCompression)
Note:
See TracChangeset
for help on using the changeset viewer.