| 197 | } |
| 198 | |
| 199 | void DrawBitmapImage(unsigned int x, unsigned int y, unsigned int w, unsigned int h, uint8_t *data) { |
| 200 | bitmap_file_header_t bmpHeader = *(bitmap_file_header_t*)data; |
| 201 | data += bmpHeader.offset; |
| 202 | |
| 203 | uint8_t bmpBpp = 24; |
| 204 | uint32_t rowSize = floor((bmpBpp*w + 31) / 32) * 4; |
| 205 | uint32_t bmp_offset = rowSize * (h - 1); |
| 206 | uint32_t bmp_buffer_offset = 0; |
| 207 | |
| 208 | uint32_t pixelSize = 4; |
| 209 | for (unsigned i = 0; i < h && i + y < videoMode.height; i++) { |
| 210 | for (unsigned j = 0; j < w && j + x < videoMode.width; j++) { |
| 211 | if(data[bmp_offset + j * (bmpBpp / 8)] == 1 && data[bmp_offset + j * (bmpBpp / 8) + 1] == 1 && data[bmp_offset + j * (bmpBpp / 8) + 2] == 1) continue; |
| 212 | uint32_t offset = (y + i)*(videoMode.width*pixelSize) + (x + j) * pixelSize; |
| 213 | videoMemory[offset] = data[bmp_offset + j * (bmpBpp / 8)]; |
| 214 | videoMemory[offset + 1] = data[bmp_offset + j * (bmpBpp / 8) + 1]; |
| 215 | videoMemory[offset + 2] = data[bmp_offset + j * (bmpBpp / 8) + 2]; |
| 216 | } |
| 217 | bmp_offset -= rowSize; |
| 218 | bmp_buffer_offset += w * pixelSize; |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | void DrawString(const char* str, unsigned int x, unsigned int y, uint8_t r, uint8_t g, uint8_t b) { |
| 223 | int xOffset = 0; |
no test coverage detected