Skip to content

Commit

Permalink
asd
Browse files Browse the repository at this point in the history
  • Loading branch information
kisvegabor committed May 14, 2024
1 parent df19f1e commit f575cd3
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/widgets/canvas/lv_canvas.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,19 @@ void lv_canvas_set_px(lv_obj_t * obj, int32_t x, int32_t y, lv_color_t color, lv
uint32_t stride = draw_buf->header.stride;
uint8_t * data = lv_draw_buf_goto_xy(draw_buf, x, y);

if(LV_COLOR_FORMAT_IS_INDEXED(cf)) {
if(cf == LV_COLOR_FORMAT_I1) {
/*Indexed image bpp could be less than 8, calculate again*/
uint8_t * buf = (uint8_t *)canvas->draw_buf->data;
buf += 2 * sizeof(lv_color32_t); /*skip the palette*/
buf += y * stride;
buf += x >> 3;
uint32_t bit = 7 - (x & 0x7);
uint32_t c_int = color.blue;

*buf &= ~(1 << bit);
*buf |= c_int << bit;
}
else if(cf == LV_COLOR_FORMAT_I1) {
/*Indexed image bpp could be less than 8, calculate again*/
uint8_t * buf = (uint8_t *)canvas->draw_buf->data;
buf += 8;
Expand Down

0 comments on commit f575cd3

Please sign in to comment.