diff --git a/legacy/oled.c b/legacy/oled.c index 16a496e7b2..b26639c2f4 100644 --- a/legacy/oled.c +++ b/legacy/oled.c @@ -340,21 +340,9 @@ void oledDrawStringRight(int x, int y, const char *text, uint8_t font) { oledDrawString(x, y, text, font); } -void oledDrawBitmap(int x, int y, const BITMAP *bmp) { +static void oled_draw_bitmap_flip(int x, int y, const BITMAP *bmp, bool flip) { for (int i = 0; i < bmp->width; i++) { - for (int j = 0; j < bmp->height; j++) { - if (bmp->data[(i / 8) + j * bmp->width / 8] & (1 << (7 - i % 8))) { - oledDrawPixel(x + i, y + j); - } else { - oledClearPixel(x + i, y + j); - } - } - } -} - -void oledDrawBitmapFlip(int x, int y, const BITMAP *bmp) { - for (int i = 0; i < bmp->width; i++) { - int ii = bmp->width - 1 - i; + int ii = flip ? i : (bmp->width - 1 - i); for (int j = 0; j < bmp->height; j++) { if (bmp->data[(ii / 8) + j * bmp->width / 8] & (1 << (7 - ii % 8))) { oledDrawPixel(x + i, y + j); @@ -365,6 +353,14 @@ void oledDrawBitmapFlip(int x, int y, const BITMAP *bmp) { } } +void oledDrawBitmap(int x, int y, const BITMAP *bmp) { + oled_draw_bitmap_flip(x, y, bmp, false); +} + +void oledDrawBitmapFlip(int x, int y, const BITMAP *bmp) { + oled_draw_bitmap_flip(x, y, bmp, true); +} + /* * Inverts box between (x1,y1) and (x2,y2) inclusive. */