lvgl/lvgl

Incomplete implementation of lv_canvas_set_px() for indexed color format

Closed this issue · 5 comments

LVGL version

v9.1

What happened?

if(LV_COLOR_FORMAT_IS_INDEXED(cf)) {

It only works for 1bit indexed format, not for others.

How to reproduce?

    uint32_t px = ((dsc->header.w + 7) >> 3) * y + x;
    buf_u8[px]  = buf_u8[px] & ~(1 << (7 - bit));
    buf_u8[px]  = buf_u8[px] | ((c.full & 0x1) << (7 - bit));

Hi, thanks for the tip. I'm not seeing it work even for I1.

From left to right: LV_COLOR_FORMAT_I1, LV_COLOR_FORMAT_I2, LV_COLOR_FORMAT_I4, LV_COLOR_FORMAT_I8, LV_COLOR_FORMAT_L8 (L8 works).

image

It's implemented but really seems related to 1 bit only.

I think it's not too difficult to fix it. The only trick is that the palette at the beginning needs to be skipped (buf += 8;)

@vitotai would you be interested in sending a pull request?

@kisvegabor

I am not good at operating those GitHub.com operations. It's a simple fix for the developers of LVGL given the fact that there is similar code in V8.

I just wanted to remind the developers and people who might be stuck on this issue.

@vitotai Always the first step is the hardest. Getting started with Pull requests, contributing to a project might be scary a little for the first time. However, I think learning these is pretty useful. Anyway, no push, we can fix it too, however if you change your mind, just let us know. We are here to help! 🙂

I couldn't resist and opened #6226 to fix it. Could you test it?