cfb: support non vtiled displays
Added support for drawing points on non-vtiled displays. Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
This commit is contained in:
parent
77c350c149
commit
8299817fba
1 changed files with 11 additions and 3 deletions
|
@ -273,8 +273,16 @@ static uint8_t draw_char_htmono(const struct char_framebuffer *fb,
|
|||
static inline void draw_point(struct char_framebuffer *fb, int16_t x, int16_t y)
|
||||
{
|
||||
const bool need_reverse = ((fb->screen_info & SCREEN_INFO_MONO_MSB_FIRST) != 0);
|
||||
const size_t index = ((y / 8) * fb->x_res);
|
||||
uint8_t m = BIT(y % 8);
|
||||
size_t index;
|
||||
uint8_t m;
|
||||
|
||||
if ((fb->screen_info & SCREEN_INFO_MONO_VTILED) != 0) {
|
||||
index = (x + (y / 8) * fb->x_res);
|
||||
m = BIT(y % 8);
|
||||
} else {
|
||||
index = ((x / 8) + y * (fb->x_res / 8));
|
||||
m = BIT(x % 8);
|
||||
}
|
||||
|
||||
if (x < 0 || x >= fb->x_res) {
|
||||
return;
|
||||
|
@ -288,7 +296,7 @@ static inline void draw_point(struct char_framebuffer *fb, int16_t x, int16_t y)
|
|||
m = byte_reverse(m);
|
||||
}
|
||||
|
||||
fb->buf[index + x] |= m;
|
||||
fb->buf[index] |= m;
|
||||
}
|
||||
|
||||
static void draw_line(struct char_framebuffer *fb, int16_t x0, int16_t y0, int16_t x1, int16_t y1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue