1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

fix(refr): take stride into consideration in partial update mode (#5583)

Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
This commit is contained in:
Neo Xu 2024-02-05 22:28:18 +08:00 committed by GitHub
parent c1cecb5692
commit 7f0b4d76d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View File

@ -952,9 +952,9 @@ void refr_obj(lv_layer_t * layer, lv_obj_t * obj)
static uint32_t get_max_row(lv_display_t * disp, int32_t area_w, int32_t area_h)
{
bool has_alpha = lv_color_format_has_alpha(disp->color_format);
uint32_t px_size_disp = lv_color_format_get_size(disp->color_format);
uint8_t px_size_render = has_alpha ? sizeof(lv_color32_t) : px_size_disp;
int32_t max_row = (uint32_t)disp->buf_act->data_size / LV_MAX(px_size_render, px_size_disp) / area_w;
lv_color_format_t cf = has_alpha ? LV_COLOR_FORMAT_ARGB8888 : disp->color_format;
uint32_t stride = lv_draw_buf_width_to_stride(area_w, cf);
int32_t max_row = (uint32_t)disp->buf_act->data_size / stride;
if(max_row > area_h) max_row = area_h;

View File

@ -211,12 +211,13 @@ static void flush_cb(lv_display_t * disp, const lv_area_t * area, uint8_t * px_m
int32_t y;
uint8_t * fb_tmp = dsc->fb_act;
uint32_t px_size = lv_color_format_get_size(lv_display_get_color_format(disp));
uint32_t px_map_stride = lv_area_get_width(area) * px_size;
uint32_t px_map_stride = lv_draw_buf_width_to_stride(lv_area_get_width(area), lv_display_get_color_format(disp));
uint32_t data_size = lv_area_get_width(area) * px_size;
int32_t fb_stride = lv_display_get_horizontal_resolution(disp) * px_size;
fb_tmp += area->y1 * fb_stride;
fb_tmp += area->x1 * px_size;
for(y = area->y1; y <= area->y2; y++) {
lv_memcpy(fb_tmp, px_map, px_map_stride);
lv_memcpy(fb_tmp, px_map, data_size);
px_map += px_map_stride;
fb_tmp += fb_stride;
}