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

fix(nxp): follow LVGL changes (#5339)

This commit is contained in:
Gabor Kiss-Vamosi 2024-01-15 17:39:55 +01:00 committed by GitHub
parent 821bb1f1a8
commit d757aa24de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 54 additions and 57 deletions

View File

@ -370,6 +370,7 @@ static void _pxp_execute_drawing(lv_draw_pxp_unit_t * u)
lv_draw_task_t * t = u->task_act;
lv_draw_unit_t * draw_unit = (lv_draw_unit_t *)u;
lv_layer_t * layer = draw_unit->target_layer;
lv_draw_buf_t * draw_buf = layer->draw_buf;
lv_area_t draw_area;
if(!_lv_area_intersect(&draw_area, &t->area, draw_unit->clip_area))
@ -377,8 +378,9 @@ static void _pxp_execute_drawing(lv_draw_pxp_unit_t * u)
/* Make area relative to the buffer */
lv_area_move(&draw_area, -layer->buf_area.x1, -layer->buf_area.y1);
/* Invalidate only the drawing area */
lv_draw_buf_invalidate_cache(layer->buf, layer->buf_stride, layer->color_format, &draw_area);
lv_draw_buf_invalidate_cache(draw_buf->data, draw_buf->header.stride, draw_buf->header.cf, &draw_area);
switch(t->type) {
case LV_DRAW_TASK_TYPE_FILL:

View File

@ -53,6 +53,7 @@ void lv_draw_pxp_fill(lv_draw_unit_t * draw_unit, const lv_draw_fill_dsc_t * dsc
return;
lv_layer_t * layer = draw_unit->target_layer;
lv_draw_buf_t * draw_buf = layer->draw_buf;
lv_area_t rel_coords;
lv_area_copy(&rel_coords, coords);
@ -66,7 +67,7 @@ void lv_draw_pxp_fill(lv_draw_unit_t * draw_unit, const lv_draw_fill_dsc_t * dsc
if(!_lv_area_intersect(&blend_area, &rel_coords, &rel_clip_area))
return; /*Fully clipped, nothing to do*/
_pxp_fill(layer->buf, &blend_area, layer->buf_stride, layer->color_format, dsc);
_pxp_fill(draw_buf->data, &blend_area, draw_buf->header.stride, draw_buf->header.cf, dsc);
}
/**********************

View File

@ -67,6 +67,7 @@ void lv_draw_pxp_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * dsc
return;
lv_layer_t * layer = draw_unit->target_layer;
lv_draw_buf_t * draw_buf = layer->draw_buf;
const lv_image_dsc_t * img_dsc = dsc->src;
lv_area_t rel_coords;
@ -94,9 +95,9 @@ void lv_draw_pxp_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * dsc
int32_t src_stride = img_dsc->header.stride;
lv_color_format_t src_cf = img_dsc->header.cf;
uint8_t * dest_buf = layer->buf;
int32_t dest_stride = layer->buf_stride;
lv_color_format_t dest_cf = layer->color_format;
uint8_t * dest_buf = draw_buf->data;
int32_t dest_stride = draw_buf->header.stride;
lv_color_format_t dest_cf = draw_buf->header.cf;
bool has_recolor = (dsc->recolor_opa > LV_OPA_MIN);
if(has_recolor && !has_transform)

View File

@ -54,33 +54,24 @@ void lv_draw_pxp_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * d
const lv_area_t * coords)
{
lv_layer_t * layer_to_draw = (lv_layer_t *)draw_dsc->src;
const lv_draw_buf_t * draw_buf = layer_to_draw->draw_buf;
/*It can happen that nothing was draw on a layer and therefore its buffer is not allocated.
*In this case just return. */
if(layer_to_draw->buf == NULL)
/* It can happen that nothing was draw on a layer and therefore its buffer is not allocated.
* In this case just return.
*/
if(draw_buf == NULL)
return;
uint32_t width = lv_area_get_width(&layer_to_draw->buf_area);
uint32_t height = lv_area_get_height(&layer_to_draw->buf_area);
const lv_area_t area = {
const lv_area_t area_to_draw = {
.x1 = 0,
.y1 = 0,
.x2 = width - 1,
.y2 = height - 1
.x2 = draw_buf->header.w - 1,
.y2 = draw_buf->header.h - 1
};
lv_draw_buf_invalidate_cache(layer_to_draw->buf, layer_to_draw->buf_stride, layer_to_draw->color_format, &area);
lv_image_dsc_t img_dsc = {0};
img_dsc.header.w = width;
img_dsc.header.h = height;
img_dsc.header.cf = layer_to_draw->color_format;
img_dsc.header.stride = layer_to_draw->buf_stride;
img_dsc.data = layer_to_draw->buf;
lv_draw_image_dsc_t new_draw_dsc;
lv_memcpy(&new_draw_dsc, draw_dsc, sizeof(lv_draw_image_dsc_t));
new_draw_dsc.src = &img_dsc;
lv_draw_buf_invalidate_cache(draw_buf->data, draw_buf->header.stride, draw_buf->header.cf, &area_to_draw);
lv_draw_image_dsc_t new_draw_dsc = *draw_dsc;
new_draw_dsc.src = draw_buf;
lv_draw_pxp_img(draw_unit, &new_draw_dsc, coords);
#if LV_USE_LAYER_DEBUG || LV_USE_PARALLEL_DRAW_DEBUG

View File

@ -31,12 +31,18 @@ extern "C" {
#if LV_USE_PXP_ASSERT
#define PXP_ASSERT(expr) LV_ASSERT(expr)
#define PXP_ASSERT_MSG(expr, msg) LV_ASSERT_MSG(expr, msg)
#else
#define PXP_ASSERT(expr)
#define PXP_ASSERT_MSG(expr, msg) LV_LOG_ERROR(msg)
#endif
#define PXP_ASSERT_MSG(expr, msg) \
do { \
if(!(expr)) { \
LV_LOG_ERROR(msg); \
PXP_ASSERT(false); \
} \
} while(0)
/**********************
* TYPEDEFS
**********************/

View File

@ -334,12 +334,11 @@ static void _vglite_execute_drawing(lv_draw_vglite_unit_t * u)
lv_draw_task_t * t = u->task_act;
lv_draw_unit_t * draw_unit = (lv_draw_unit_t *)u;
lv_layer_t * layer = draw_unit->target_layer;
lv_draw_buf_t * draw_buf = layer->draw_buf;
/* Set target buffer */
uint32_t buf_width = lv_area_get_width(&layer->buf_area);
uint32_t buf_height = lv_area_get_height(&layer->buf_area);
vglite_set_dest_buf(layer->buf, buf_width, buf_height, layer->buf_stride, layer->color_format);
vglite_set_dest_buf(draw_buf->data, draw_buf->header.w, draw_buf->header.h, draw_buf->header.stride,
draw_buf->header.cf);
lv_area_t clip_area;
lv_area_copy(&clip_area, draw_unit->clip_area);
@ -353,7 +352,7 @@ static void _vglite_execute_drawing(lv_draw_vglite_unit_t * u)
return; /*Fully clipped, nothing to do*/
/* Invalidate the drawing area */
lv_draw_buf_invalidate_cache(layer->buf, layer->buf_stride, layer->color_format, &draw_area);
lv_draw_buf_invalidate_cache(draw_buf->data, draw_buf->header.stride, draw_buf->header.cf, &draw_area);
/* Set scissor area */
vglite_set_scissor(&clip_area);

View File

@ -163,9 +163,9 @@ void lv_draw_vglite_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t *
vglite_set_src_buf(src_buf, lv_area_get_width(&src_area), lv_area_get_height(&src_area), src_stride, src_cf);
#if LV_USE_VGLITE_BLIT_SPLIT
void * dest_buf = layer->buf;
uint32_t dest_stride = layer->buf_stride;
lv_color_format_t dest_cf = layer->color_format;
void * dest_buf = layer->draw_buf->data;
uint32_t dest_stride = layer->draw_buf->header.stride;
lv_color_format_t dest_cf = layer->draw_buf->header.cf;
if(!has_transform)
_vglite_blit_split(dest_buf, &blend_area, dest_stride, dest_cf,

View File

@ -54,33 +54,24 @@ void lv_draw_vglite_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t
const lv_area_t * coords)
{
lv_layer_t * layer_to_draw = (lv_layer_t *)draw_dsc->src;
const lv_draw_buf_t * draw_buf = layer_to_draw->draw_buf;
/*It can happen that nothing was draw on a layer and therefore its buffer is not allocated.
*In this case just return. */
if(layer_to_draw->buf == NULL)
/* It can happen that nothing was draw on a layer and therefore its buffer is not allocated.
* In this case just return.
*/
if(draw_buf == NULL)
return;
uint32_t width = lv_area_get_width(&layer_to_draw->buf_area);
uint32_t height = lv_area_get_height(&layer_to_draw->buf_area);
const lv_area_t area = {
const lv_area_t area_to_draw = {
.x1 = 0,
.y1 = 0,
.x2 = width - 1,
.y2 = height - 1
.x2 = draw_buf->header.w - 1,
.y2 = draw_buf->header.h - 1
};
lv_draw_buf_invalidate_cache(layer_to_draw->buf, layer_to_draw->buf_stride, layer_to_draw->color_format, &area);
lv_image_dsc_t img_dsc = {0};
img_dsc.header.w = width;
img_dsc.header.h = height;
img_dsc.header.cf = layer_to_draw->color_format;
img_dsc.header.stride = layer_to_draw->buf_stride;
img_dsc.data = layer_to_draw->buf;
lv_draw_image_dsc_t new_draw_dsc;
lv_memcpy(&new_draw_dsc, draw_dsc, sizeof(lv_draw_image_dsc_t));
new_draw_dsc.src = &img_dsc;
lv_draw_buf_invalidate_cache(draw_buf->data, draw_buf->header.stride, draw_buf->header.cf, &area_to_draw);
lv_draw_image_dsc_t new_draw_dsc = *draw_dsc;
new_draw_dsc.src = draw_buf;
lv_draw_vglite_img(draw_unit, &new_draw_dsc, coords);
#if LV_USE_LAYER_DEBUG || LV_USE_PARALLEL_DRAW_DEBUG

View File

@ -37,12 +37,18 @@ extern "C" {
#if LV_USE_VGLITE_ASSERT
#define VGLITE_ASSERT(expr) LV_ASSERT(expr)
#define VGLITE_ASSERT_MSG(expr, msg) LV_ASSERT_MSG(expr, msg)
#else
#define VGLITE_ASSERT(expr)
#define VGLITE_ASSERT_MSG(expr, msg) LV_LOG_ERROR(msg)
#endif
#define VGLITE_ASSERT_MSG(expr, msg) \
do { \
if(!(expr)) { \
LV_LOG_ERROR(msg); \
VGLITE_ASSERT(false); \
} \
} while(0)
#define VGLITE_CHECK_ERROR(function) \
do { \
vg_lite_error_t error = function; \