mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
feat(draw_buf): misc update (#5498)
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
This commit is contained in:
parent
152dc0b2be
commit
da3ff11bd5
@ -296,8 +296,12 @@ lv_draw_buf_t * lv_draw_buf_adjust_stride(const lv_draw_buf_t * src, uint32_t st
|
|||||||
lv_draw_buf_t * dst = lv_draw_buf_create(header->w, header->h, header->cf, stride);
|
lv_draw_buf_t * dst = lv_draw_buf_create(header->w, header->h, header->cf, stride);
|
||||||
if(dst == NULL) return NULL;
|
if(dst == NULL) return NULL;
|
||||||
|
|
||||||
|
uint32_t offset = LV_COLOR_INDEXED_PALETTE_SIZE(header->cf) * 4;
|
||||||
|
if(offset) lv_memcpy(dst->data, src->data, offset);
|
||||||
uint8_t * dst_data = dst->data;
|
uint8_t * dst_data = dst->data;
|
||||||
|
dst_data += offset;
|
||||||
const uint8_t * src_data = src->data;
|
const uint8_t * src_data = src->data;
|
||||||
|
src_data += offset;
|
||||||
for(int32_t y = 0; y < src->header.h; y++) {
|
for(int32_t y = 0; y < src->header.h; y++) {
|
||||||
lv_memcpy(dst_data, src_data, min_stride);
|
lv_memcpy(dst_data, src_data, min_stride);
|
||||||
src_data += src->header.stride;
|
src_data += src->header.stride;
|
||||||
|
@ -224,6 +224,16 @@ static inline bool lv_draw_buf_has_flag(lv_draw_buf_t * draw_buf, lv_image_flags
|
|||||||
return draw_buf->header.flags & flag;
|
return draw_buf->header.flags & flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void lv_draw_buf_set_flag(lv_draw_buf_t * draw_buf, lv_image_flags_t flag)
|
||||||
|
{
|
||||||
|
draw_buf->header.flags |= flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void lv_draw_buf_clear_flag(lv_draw_buf_t * draw_buf, lv_image_flags_t flag)
|
||||||
|
{
|
||||||
|
draw_buf->header.flags &= ~flag;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* As of now, draw buf share same definition as `lv_image_dsc_t`.
|
* As of now, draw buf share same definition as `lv_image_dsc_t`.
|
||||||
* And is interchangeable with `lv_image_dsc_t`.
|
* And is interchangeable with `lv_image_dsc_t`.
|
||||||
|
@ -104,6 +104,9 @@ static void draw_execute(lv_draw_vg_lite_unit_t * u)
|
|||||||
|
|
||||||
lv_vg_lite_buffer_from_draw_buf(&u->target_buffer, layer->draw_buf);
|
lv_vg_lite_buffer_from_draw_buf(&u->target_buffer, layer->draw_buf);
|
||||||
|
|
||||||
|
/* VG-Lite will output premultiplied image, set the flag correspondingly. */
|
||||||
|
lv_draw_buf_set_flag(layer->draw_buf, LV_IMAGE_FLAGS_PREMULTIPLIED);
|
||||||
|
|
||||||
vg_lite_identity(&u->global_matrix);
|
vg_lite_identity(&u->global_matrix);
|
||||||
vg_lite_translate(-layer->buf_area.x1, -layer->buf_area.y1, &u->global_matrix);
|
vg_lite_translate(-layer->buf_area.x1, -layer->buf_area.y1, &u->global_matrix);
|
||||||
|
|
||||||
|
@ -51,7 +51,9 @@ void lv_draw_vg_lite_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t
|
|||||||
LV_PROFILER_BEGIN;
|
LV_PROFILER_BEGIN;
|
||||||
|
|
||||||
/* The GPU output should already be premultiplied RGB */
|
/* The GPU output should already be premultiplied RGB */
|
||||||
layer->draw_buf->header.flags |= LV_IMAGE_FLAGS_PREMULTIPLIED;
|
if(!lv_draw_buf_has_flag(layer->draw_buf, LV_IMAGE_FLAGS_PREMULTIPLIED)) {
|
||||||
|
LV_LOG_WARN("Non-premultiplied layer buffer for GPU to draw.");
|
||||||
|
}
|
||||||
|
|
||||||
lv_draw_image_dsc_t new_draw_dsc = *draw_dsc;
|
lv_draw_image_dsc_t new_draw_dsc = *draw_dsc;
|
||||||
new_draw_dsc.src = layer->draw_buf;
|
new_draw_dsc.src = layer->draw_buf;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user