fix bitmap drawing, align number picker screen to center
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user