display: fix font cell row/col-major bug causing garbled glyphs (draw_bitmap expects row-major)
This commit is contained in:
@@ -128,11 +128,13 @@ int display_put_text(int x, int y, const char *str, uint16_t fg, uint16_t bg)
|
|||||||
char c = *str++;
|
char c = *str++;
|
||||||
if (c >= FONT5X7_FIRST_CHAR && c <= FONT5X7_LAST_CHAR) {
|
if (c >= FONT5X7_FIRST_CHAR && c <= FONT5X7_LAST_CHAR) {
|
||||||
const uint8_t *glyph = font5x7[c - FONT5X7_FIRST_CHAR];
|
const uint8_t *glyph = font5x7[c - FONT5X7_FIRST_CHAR];
|
||||||
uint16_t cell[FONT5X7_W][FONT5X7_H];
|
/* Row-major [row][col] so the linear buffer matches what
|
||||||
|
* esp_lcd_panel_draw_bitmap expects. */
|
||||||
|
uint16_t cell[FONT5X7_H][FONT5X7_W];
|
||||||
|
|
||||||
for (int gy = 0; gy < FONT5X7_H; gy++) {
|
for (int gy = 0; gy < FONT5X7_H; gy++) {
|
||||||
for (int gx = 0; gx < FONT5X7_W; gx++) {
|
for (int gx = 0; gx < FONT5X7_W; gx++) {
|
||||||
cell[gx][gy] = (glyph[gy] >> gx) & 1 ? fg : bg;
|
cell[gy][gx] = (glyph[gy] >> gx) & 1 ? fg : bg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (x + FONT5X7_W <= DISP_W && y + FONT5X7_H <= DISP_H) {
|
if (x + FONT5X7_W <= DISP_W && y + FONT5X7_H <= DISP_H) {
|
||||||
|
|||||||
Reference in New Issue
Block a user