fix(vg_lite): fix draw mask rect error (#5372)
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com> Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
@@ -108,7 +108,7 @@ static void draw_execute(lv_draw_vg_lite_unit_t * u)
|
|||||||
lv_draw_vg_lite_box_shadow(draw_unit, t->draw_dsc, &t->area);
|
lv_draw_vg_lite_box_shadow(draw_unit, t->draw_dsc, &t->area);
|
||||||
break;
|
break;
|
||||||
case LV_DRAW_TASK_TYPE_IMAGE:
|
case LV_DRAW_TASK_TYPE_IMAGE:
|
||||||
lv_draw_vg_lite_img(draw_unit, t->draw_dsc, &t->area);
|
lv_draw_vg_lite_img(draw_unit, t->draw_dsc, &t->area, false);
|
||||||
break;
|
break;
|
||||||
case LV_DRAW_TASK_TYPE_ARC:
|
case LV_DRAW_TASK_TYPE_ARC:
|
||||||
lv_draw_vg_lite_arc(draw_unit, t->draw_dsc, &t->area);
|
lv_draw_vg_lite_arc(draw_unit, t->draw_dsc, &t->area);
|
||||||
@@ -200,7 +200,7 @@ static int32_t draw_evaluate(lv_draw_unit_t * draw_unit, lv_draw_task_t * task)
|
|||||||
case LV_DRAW_TASK_TYPE_LINE:
|
case LV_DRAW_TASK_TYPE_LINE:
|
||||||
case LV_DRAW_TASK_TYPE_ARC:
|
case LV_DRAW_TASK_TYPE_ARC:
|
||||||
case LV_DRAW_TASK_TYPE_TRIANGLE:
|
case LV_DRAW_TASK_TYPE_TRIANGLE:
|
||||||
// case LV_DRAW_TASK_TYPE_MASK_RECTANGLE:
|
case LV_DRAW_TASK_TYPE_MASK_RECTANGLE:
|
||||||
// case LV_DRAW_TASK_TYPE_MASK_BITMAP:
|
// case LV_DRAW_TASK_TYPE_MASK_BITMAP:
|
||||||
#if LV_USE_VECTOR_GRAPHIC
|
#if LV_USE_VECTOR_GRAPHIC
|
||||||
case LV_DRAW_TASK_TYPE_VECTOR:
|
case LV_DRAW_TASK_TYPE_VECTOR:
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ void lv_draw_vg_lite_fill(lv_draw_unit_t * draw_unit, const lv_draw_fill_dsc_t *
|
|||||||
const lv_area_t * coords);
|
const lv_area_t * coords);
|
||||||
|
|
||||||
void lv_draw_vg_lite_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * dsc,
|
void lv_draw_vg_lite_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * dsc,
|
||||||
const lv_area_t * coords);
|
const lv_area_t * coords, bool no_cache);
|
||||||
|
|
||||||
void lv_draw_vg_lite_label(lv_draw_unit_t * draw_unit, const lv_draw_label_dsc_t * dsc,
|
void lv_draw_vg_lite_label(lv_draw_unit_t * draw_unit, const lv_draw_label_dsc_t * dsc,
|
||||||
const lv_area_t * coords);
|
const lv_area_t * coords);
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ void lv_draw_vg_lite_arc(lv_draw_unit_t * draw_unit, const lv_draw_arc_dsc_t * d
|
|||||||
if(dsc->img_src) {
|
if(dsc->img_src) {
|
||||||
vg_lite_buffer_t src_buf;
|
vg_lite_buffer_t src_buf;
|
||||||
lv_image_decoder_dsc_t decoder_dsc;
|
lv_image_decoder_dsc_t decoder_dsc;
|
||||||
if(lv_vg_lite_buffer_open_image(&src_buf, &decoder_dsc, dsc->img_src)) {
|
if(lv_vg_lite_buffer_open_image(&src_buf, &decoder_dsc, dsc->img_src, false)) {
|
||||||
vg_lite_matrix_t path_matrix;
|
vg_lite_matrix_t path_matrix;
|
||||||
vg_lite_identity(&path_matrix);
|
vg_lite_identity(&path_matrix);
|
||||||
LV_VG_LITE_CHECK_ERROR(vg_lite_draw_pattern(
|
LV_VG_LITE_CHECK_ERROR(vg_lite_draw_pattern(
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
void lv_draw_vg_lite_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * dsc,
|
void lv_draw_vg_lite_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * dsc,
|
||||||
const lv_area_t * coords)
|
const lv_area_t * coords, bool no_cache)
|
||||||
{
|
{
|
||||||
if(dsc->opa <= LV_OPA_MIN) {
|
if(dsc->opa <= LV_OPA_MIN) {
|
||||||
return;
|
return;
|
||||||
@@ -71,7 +71,7 @@ void lv_draw_vg_lite_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t *
|
|||||||
|
|
||||||
vg_lite_buffer_t src_buf;
|
vg_lite_buffer_t src_buf;
|
||||||
lv_image_decoder_dsc_t decoder_dsc;
|
lv_image_decoder_dsc_t decoder_dsc;
|
||||||
if(!lv_vg_lite_buffer_open_image(&src_buf, &decoder_dsc, dsc->src)) {
|
if(!lv_vg_lite_buffer_open_image(&src_buf, &decoder_dsc, dsc->src, no_cache)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ static void draw_letter_cb(lv_draw_unit_t * draw_unit, lv_draw_glyph_dsc_t * gly
|
|||||||
lv_draw_image_dsc_init(&img_dsc);
|
lv_draw_image_dsc_init(&img_dsc);
|
||||||
img_dsc.opa = glyph_draw_dsc->opa;
|
img_dsc.opa = glyph_draw_dsc->opa;
|
||||||
img_dsc.src = glyph_draw_dsc->glyph_data;
|
img_dsc.src = glyph_draw_dsc->glyph_data;
|
||||||
lv_draw_vg_lite_img(draw_unit, &img_dsc, glyph_draw_dsc->letter_coords);
|
lv_draw_vg_lite_img(draw_unit, &img_dsc, glyph_draw_dsc->letter_coords, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -49,14 +49,11 @@ void lv_draw_vg_lite_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* The GPU output should already be premultiplied RGB */
|
/* The GPU output should already be premultiplied RGB */
|
||||||
if((layer->draw_buf->header.flags & LV_IMAGE_FLAGS_PREMULTIPLIED) == 0) {
|
layer->draw_buf->header.flags |= LV_IMAGE_FLAGS_PREMULTIPLIED;
|
||||||
LV_LOG_WARN("GPU output is not premultiplied RGB.");
|
|
||||||
layer->draw_buf->header.flags |= LV_IMAGE_FLAGS_PREMULTIPLIED;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
||||||
lv_draw_vg_lite_img(draw_unit, &new_draw_dsc, coords);
|
lv_draw_vg_lite_img(draw_unit, &new_draw_dsc, coords, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
|
|||||||
@@ -68,10 +68,7 @@ void lv_draw_vg_lite_mask_rect(lv_draw_unit_t * draw_unit, const lv_draw_mask_re
|
|||||||
y - target_layer->buf_area.y1);
|
y - target_layer->buf_area.y1);
|
||||||
|
|
||||||
if(res == LV_DRAW_SW_MASK_RES_TRANSP) {
|
if(res == LV_DRAW_SW_MASK_RES_TRANSP) {
|
||||||
uint32_t i;
|
lv_memzero(c32_buf, area_w * sizeof(lv_color32_t));
|
||||||
for(i = 0; i < area_w; i++) {
|
|
||||||
c32_buf[i].alpha = 0x00;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
@@ -79,6 +76,9 @@ void lv_draw_vg_lite_mask_rect(lv_draw_unit_t * draw_unit, const lv_draw_mask_re
|
|||||||
if(mask_buf[i] != LV_OPA_COVER) {
|
if(mask_buf[i] != LV_OPA_COVER) {
|
||||||
c32_buf[i].alpha = LV_OPA_MIX2(c32_buf[i].alpha, mask_buf[i]);
|
c32_buf[i].alpha = LV_OPA_MIX2(c32_buf[i].alpha, mask_buf[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*Pre-multiply the alpha*/
|
||||||
|
lv_color_premultiply(&c32_buf[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ static void task_draw_cb(void * ctx, const lv_vector_path_t * path, const lv_vec
|
|||||||
/* draw image */
|
/* draw image */
|
||||||
vg_lite_buffer_t image_buffer;
|
vg_lite_buffer_t image_buffer;
|
||||||
lv_image_decoder_dsc_t decoder_dsc;
|
lv_image_decoder_dsc_t decoder_dsc;
|
||||||
if(lv_vg_lite_buffer_open_image(&image_buffer, &decoder_dsc, dsc->fill_dsc.img_dsc.src)) {
|
if(lv_vg_lite_buffer_open_image(&image_buffer, &decoder_dsc, dsc->fill_dsc.img_dsc.src, false)) {
|
||||||
lv_matrix_t m = dsc->matrix;
|
lv_matrix_t m = dsc->matrix;
|
||||||
lv_matrix_translate(&m, min_x, min_y);
|
lv_matrix_translate(&m, min_x, min_y);
|
||||||
lv_matrix_multiply(&m, &dsc->fill_dsc.matrix);
|
lv_matrix_multiply(&m, &dsc->fill_dsc.matrix);
|
||||||
|
|||||||
@@ -592,7 +592,8 @@ void lv_vg_lite_image_matrix(vg_lite_matrix_t * matrix, int32_t x, int32_t y, co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool lv_vg_lite_buffer_open_image(vg_lite_buffer_t * buffer, lv_image_decoder_dsc_t * decoder_dsc, const void * src)
|
bool lv_vg_lite_buffer_open_image(vg_lite_buffer_t * buffer, lv_image_decoder_dsc_t * decoder_dsc, const void * src,
|
||||||
|
bool no_cache)
|
||||||
{
|
{
|
||||||
LV_ASSERT_NULL(buffer);
|
LV_ASSERT_NULL(buffer);
|
||||||
LV_ASSERT_NULL(decoder_dsc);
|
LV_ASSERT_NULL(decoder_dsc);
|
||||||
@@ -603,6 +604,7 @@ bool lv_vg_lite_buffer_open_image(vg_lite_buffer_t * buffer, lv_image_decoder_ds
|
|||||||
args.premultiply = !lv_vg_lite_support_blend_normal();
|
args.premultiply = !lv_vg_lite_support_blend_normal();
|
||||||
args.stride_align = true;
|
args.stride_align = true;
|
||||||
args.use_indexed = true;
|
args.use_indexed = true;
|
||||||
|
args.no_cache = no_cache;
|
||||||
|
|
||||||
lv_result_t res = lv_image_decoder_open(decoder_dsc, src, &args);
|
lv_result_t res = lv_image_decoder_open(decoder_dsc, src, &args);
|
||||||
if(res != LV_RESULT_OK) {
|
if(res != LV_RESULT_OK) {
|
||||||
|
|||||||
@@ -124,7 +124,8 @@ void lv_vg_lite_buffer_from_draw_buf(vg_lite_buffer_t * buffer, const lv_draw_bu
|
|||||||
|
|
||||||
void lv_vg_lite_image_matrix(vg_lite_matrix_t * matrix, int32_t x, int32_t y, const lv_draw_image_dsc_t * dsc);
|
void lv_vg_lite_image_matrix(vg_lite_matrix_t * matrix, int32_t x, int32_t y, const lv_draw_image_dsc_t * dsc);
|
||||||
|
|
||||||
bool lv_vg_lite_buffer_open_image(vg_lite_buffer_t * buffer, lv_image_decoder_dsc_t * decoder_dsc, const void * src);
|
bool lv_vg_lite_buffer_open_image(vg_lite_buffer_t * buffer, lv_image_decoder_dsc_t * decoder_dsc, const void * src,
|
||||||
|
bool no_cache);
|
||||||
|
|
||||||
vg_lite_blend_t lv_vg_lite_blend_mode(lv_blend_mode_t blend_mode);
|
vg_lite_blend_t lv_vg_lite_blend_mode(lv_blend_mode_t blend_mode);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user