* Reads a 8 bpp bitmap */
| 143 | * Reads a 8 bpp bitmap |
| 144 | */ |
| 145 | static inline bool BmpRead8(RandomAccessFile &file, BmpInfo &info, BmpData &data) |
| 146 | { |
| 147 | uint8_t pad = GB(4 - info.width, 0, 2); |
| 148 | for (uint y = info.height; y > 0; y--) { |
| 149 | if (file.AtEndOfFile()) return false; // the file is shorter than expected |
| 150 | uint8_t *pixel = &data.bitmap[(y - 1) * static_cast<size_t>(info.width)]; |
| 151 | for (uint i = 0; i < info.width; i++) *pixel++ = file.ReadByte(); |
| 152 | /* Padding for 32 bit align */ |
| 153 | file.SkipBytes(pad); |
| 154 | } |
| 155 | return true; |
| 156 | } |
| 157 | |
| 158 | /** |
| 159 | * Reads a 8-bit RLE compressed bpp bitmap |
no test coverage detected