cfb: fix get_glyph_byte for vtiled displays
V-Tiled displays need different treatment when getting the glyph byte. Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
This commit is contained in:
parent
276d447f51
commit
b5c634f4bb
1 changed files with 11 additions and 6 deletions
|
@ -75,10 +75,14 @@ static inline uint8_t *get_glyph_ptr(const struct cfb_font *fptr, uint8_t c)
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint8_t get_glyph_byte(uint8_t *glyph_ptr, const struct cfb_font *fptr,
|
static inline uint8_t get_glyph_byte(uint8_t *glyph_ptr, const struct cfb_font *fptr,
|
||||||
uint8_t x, uint8_t y)
|
uint8_t x, uint8_t y, bool vtiled)
|
||||||
{
|
{
|
||||||
if (fptr->caps & CFB_FONT_MONO_VPACKED) {
|
if (fptr->caps & CFB_FONT_MONO_VPACKED) {
|
||||||
return glyph_ptr[(x * fptr->height + y) / 8];
|
if (vtiled) {
|
||||||
|
return glyph_ptr[x * (fptr->height / 8U) + y];
|
||||||
|
} else {
|
||||||
|
return glyph_ptr[(x * fptr->height + y) / 8];
|
||||||
|
}
|
||||||
} else if (fptr->caps & CFB_FONT_MONO_HPACKED) {
|
} else if (fptr->caps & CFB_FONT_MONO_HPACKED) {
|
||||||
return glyph_ptr[y * (fptr->width) + x];
|
return glyph_ptr[y * (fptr->width) + x];
|
||||||
}
|
}
|
||||||
|
@ -140,10 +144,11 @@ static uint8_t draw_char_vtmono(const struct char_framebuffer *fb,
|
||||||
* So, we process assume that nothing is drawn above.
|
* So, we process assume that nothing is drawn above.
|
||||||
*/
|
*/
|
||||||
byte = 0;
|
byte = 0;
|
||||||
next_byte = get_glyph_byte(glyph_ptr, fptr, g_x, g_y / 8);
|
next_byte = get_glyph_byte(glyph_ptr, fptr, g_x, g_y / 8, true);
|
||||||
} else {
|
} else {
|
||||||
byte = get_glyph_byte(glyph_ptr, fptr, g_x, g_y / 8);
|
byte = get_glyph_byte(glyph_ptr, fptr, g_x, g_y / 8, true);
|
||||||
next_byte = get_glyph_byte(glyph_ptr, fptr, g_x, (g_y + 8) / 8);
|
next_byte =
|
||||||
|
get_glyph_byte(glyph_ptr, fptr, g_x, (g_y + 8) / 8, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (font_is_msbfirst) {
|
if (font_is_msbfirst) {
|
||||||
|
@ -246,7 +251,7 @@ static uint8_t draw_char_htmono(const struct char_framebuffer *fb,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte = get_glyph_byte(glyph_ptr, fptr, g_x, g_y);
|
byte = get_glyph_byte(glyph_ptr, fptr, g_x, g_y, false);
|
||||||
if (font_is_msbfirst) {
|
if (font_is_msbfirst) {
|
||||||
byte = byte_reverse(byte);
|
byte = byte_reverse(byte);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue