1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

fix(display): fix incorrect assert conditions (#5400)

This commit is contained in:
Benign X 2024-01-20 01:07:52 +08:00 committed by GitHub
parent f470539f4c
commit a8f1d82b66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -413,15 +413,13 @@ void lv_display_set_buffers(lv_display_t * disp, void * buf1, void * buf2, uint3
if(render_mode == LV_DISPLAY_RENDER_MODE_PARTIAL) {
/* for partial mode, we calculate the height based on the buf_size and stride */
h = buf_size / stride;
LV_ASSERT_MSG(h != 0, "the buffer is too small");
}
else {
LV_ASSERT_MSG(stride * h < buf_size, "%s mode requires screen sized buffer(s)",
LV_ASSERT_MSG(stride * h <= buf_size, "%s mode requires screen sized buffer(s)",
render_mode == LV_DISPLAY_RENDER_MODE_FULL ? "FULL" : "DIRECT");
return;
}
LV_ASSERT_MSG(h != 0, "the buffer is too small");
lv_draw_buf_init(&disp->_static_buf1, w, h, cf, stride, buf1, buf_size);
lv_draw_buf_init(&disp->_static_buf2, w, h, cf, stride, buf2, buf_size);
lv_display_set_draw_buffers(disp, &disp->_static_buf1, buf2 ? &disp->_static_buf2 : NULL);