mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-19 12:58:13 +00:00
fix(legacy): refactor oledDrawBitmap and oledDrawBitmapFlip
into a single function
This commit is contained in:
parent
72691a93d5
commit
4d2237b32b
@ -340,21 +340,9 @@ void oledDrawStringRight(int x, int y, const char *text, uint8_t font) {
|
|||||||
oledDrawString(x, y, text, 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 i = 0; i < bmp->width; i++) {
|
||||||
for (int j = 0; j < bmp->height; j++) {
|
int ii = flip ? i : (bmp->width - 1 - i);
|
||||||
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;
|
|
||||||
for (int j = 0; j < bmp->height; j++) {
|
for (int j = 0; j < bmp->height; j++) {
|
||||||
if (bmp->data[(ii / 8) + j * bmp->width / 8] & (1 << (7 - ii % 8))) {
|
if (bmp->data[(ii / 8) + j * bmp->width / 8] & (1 << (7 - ii % 8))) {
|
||||||
oledDrawPixel(x + i, y + j);
|
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.
|
* Inverts box between (x1,y1) and (x2,y2) inclusive.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user