* Reads the bitmap * 1 bpp and 4 bpp bitmaps are converted to 8 bpp bitmaps */
| 315 | * 1 bpp and 4 bpp bitmaps are converted to 8 bpp bitmaps |
| 316 | */ |
| 317 | bool BmpReadBitmap(RandomAccessFile &file, BmpInfo &info, BmpData &data) |
| 318 | { |
| 319 | data.bitmap.resize(static_cast<size_t>(info.width) * info.height * ((info.bpp == 24) ? 3 : 1)); |
| 320 | |
| 321 | /* Load image */ |
| 322 | file.SeekTo(info.offset, SEEK_SET); |
| 323 | switch (info.compression) { |
| 324 | case 0: // no compression |
| 325 | switch (info.bpp) { |
| 326 | case 1: return BmpRead1(file, info, data); |
| 327 | case 4: return BmpRead4(file, info, data); |
| 328 | case 8: return BmpRead8(file, info, data); |
| 329 | case 24: return BmpRead24(file, info, data); |
| 330 | default: NOT_REACHED(); |
| 331 | } |
| 332 | break; |
| 333 | |
| 334 | case 1: return BmpRead8Rle(file, info, data); // 8-bit RLE compression |
| 335 | case 2: return BmpRead4Rle(file, info, data); // 4-bit RLE compression |
| 336 | default: NOT_REACHED(); |
| 337 | } |
| 338 | } |
no test coverage detected