Skip to content

Commit 8299817

Browse files
yishai1999kartben
authored andcommitted
cfb: support non vtiled displays
Added support for drawing points on non-vtiled displays. Signed-off-by: Yishai Jaffe <[email protected]>
1 parent 77c350c commit 8299817

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

subsys/fb/cfb.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,16 @@ static uint8_t draw_char_htmono(const struct char_framebuffer *fb,
273273
static inline void draw_point(struct char_framebuffer *fb, int16_t x, int16_t y)
274274
{
275275
const bool need_reverse = ((fb->screen_info & SCREEN_INFO_MONO_MSB_FIRST) != 0);
276-
const size_t index = ((y / 8) * fb->x_res);
277-
uint8_t m = BIT(y % 8);
276+
size_t index;
277+
uint8_t m;
278+
279+
if ((fb->screen_info & SCREEN_INFO_MONO_VTILED) != 0) {
280+
index = (x + (y / 8) * fb->x_res);
281+
m = BIT(y % 8);
282+
} else {
283+
index = ((x / 8) + y * (fb->x_res / 8));
284+
m = BIT(x % 8);
285+
}
278286

279287
if (x < 0 || x >= fb->x_res) {
280288
return;
@@ -288,7 +296,7 @@ static inline void draw_point(struct char_framebuffer *fb, int16_t x, int16_t y)
288296
m = byte_reverse(m);
289297
}
290298

291-
fb->buf[index + x] |= m;
299+
fb->buf[index] |= m;
292300
}
293301

294302
static void draw_line(struct char_framebuffer *fb, int16_t x0, int16_t y0, int16_t x1, int16_t y1)

0 commit comments

Comments
 (0)