fix bitmap drawing, align number picker screen to center

This commit is contained in:
2020-01-12 13:21:39 +01:00
parent 8a2fe2a18b
commit 9b604aab4e
3 changed files with 64 additions and 7 deletions
+4 -4
View File
@@ -324,13 +324,13 @@ void LCD_setBitmapFullScreen(const uint8_t *bitArray)
void LCD_setBitmap(const struct BitmapImage *image, int x, int y, bool bg, enum Color color)
{
int byte_count = image->width * (image->height + 7) / 8;
// int byte_count = image->width * ((image->height + 7) / 8);
for (int xi = 0; xi < image->width; xi++) {
for (int yi = 0; yi < image->height; yi++) {
int idx = xi + ((yi + 7) / 8) * image->width;
if (idx > byte_count) continue;
bool bit = image->bytes[idx] & (1 << yi);
int idx = xi + (yi / 8) * image->width;
// if (idx > byte_count) continue;
bool bit = image->bytes[idx] & (1 << (yi % 8));
if (bit) {
LCD_setPixel(x + xi, y + yi, color);
}