fix(dave2d): fix several rendering issues (mostly restore the original alpha) (#9566)
Arduino Lint / lint (push) Has been cancelled
Build Examples with C++ Compiler / build-examples (push) Has been cancelled
MicroPython CI / Build esp32 port (push) Has been cancelled
MicroPython CI / Build rp2 port (push) Has been cancelled
MicroPython CI / Build stm32 port (push) Has been cancelled
MicroPython CI / Build unix port (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_NORMAL_8BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_SDL - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build ESP IDF ESP32S3 (push) Has been cancelled
C/C++ CI / Run tests with 32bit build (push) Has been cancelled
C/C++ CI / Run tests with 64bit build (push) Has been cancelled
BOM Check / bom-check (push) Has been cancelled
Verify that lv_conf_internal.h matches repository state / verify-conf-internal (push) Has been cancelled
Verify the widget property name / verify-property-name (push) Has been cancelled
Verify code formatting / verify-formatting (push) Has been cancelled
Compare file templates with file names / template-check (push) Has been cancelled
Build docs / build-and-deploy (push) Has been cancelled
Test API JSON generator / Test API JSON (push) Has been cancelled
Install LVGL using CMake / build-examples (push) Has been cancelled
Check Makefile / Build using Makefile (push) Has been cancelled
Check Makefile for UEFI / Build using Makefile for UEFI (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/benchmark_results_comment/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/filter_docker_logs/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/serialize_results/test.sh) (push) Has been cancelled
Hardware Performance Test / Hardware Performance Benchmark (push) Has been cancelled
Hardware Performance Test / HW Benchmark - Save PR Number (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_32B - Ubuntu (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_64B - Ubuntu (push) Has been cancelled
Port repo release update / run-release-branch-updater (push) Has been cancelled
Verify Font License / verify-font-license (push) Has been cancelled
Verify Kconfig / verify-kconfig (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 32b - lv_conf_perf32b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 64b - lv_conf_perf64b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Save PR Number (push) Has been cancelled
Close stale issues and PRs / stale (push) Has been cancelled

This commit is contained in:
Gabor Kiss-Vamosi
2026-02-03 21:27:02 +01:00
committed by GitHub
parent a0eb432d96
commit 84861b8bf2
6 changed files with 29 additions and 5 deletions
+5 -3
View File
@@ -18,9 +18,11 @@
/* The amount of tasks exercising pressure to the current to get finished
* This one is used as the main signal to start to render a block of tasks.
*/
#define DAVE2D_MAX_DRAW_PRESSURE 256
#ifndef LV_DAVE2D_MAX_DRAW_PRESSURE
#define LV_DAVE2D_MAX_DRAW_PRESSURE 256
#endif
#if (DAVE2D_MAX_DRAW_PRESSURE < 256)
#if (LV_DAVE2D_MAX_DRAW_PRESSURE < 256)
#error "DRAW Pressure should be at least 256 otherwise the Dave engine may crash!"
#endif
/**********************
@@ -403,7 +405,7 @@ static int32_t lv_draw_dave2d_dispatch(lv_draw_unit_t * draw_unit, lv_layer_t *
deps = lv_draw_get_dependent_count(t);
if(deps > 0 || draw_pressure > 0) {
draw_pressure += deps;
if(draw_pressure < DAVE2D_MAX_DRAW_PRESSURE) {
if(draw_pressure < LV_DAVE2D_MAX_DRAW_PRESSURE) {
/* No other tasks are pressuring to get the current block
* of tasks including the latest one, just accumulate it
* and tells the drawing pipeline to send a new one if there is any
@@ -68,6 +68,7 @@ static void dave2d_draw_border_simple(lv_draw_task_t * t, const lv_area_t * oute
LV_ASSERT(LV_RESULT_OK == status);
#endif
d2_u8 current_alpha = d2_getalpha(u->d2_handle);
local_outer_area = *outer_area;
local_inner_area = *inner_area;
@@ -136,6 +137,8 @@ static void dave2d_draw_border_simple(lv_draw_task_t * t, const lv_area_t * oute
(d2_point)D2_FIX4(lv_area_get_height(&a)));
}
d2_setalpha(u->d2_handle, current_alpha);
#if LV_USE_OS
status = lv_mutex_unlock(u->pd2Mutex);
LV_ASSERT(LV_RESULT_OK == status);
@@ -168,6 +171,8 @@ static void dave2d_draw_border_complex(lv_draw_task_t * t, const lv_area_t * ori
LV_ASSERT(LV_RESULT_OK == status);
#endif
d2_u8 current_alpha = d2_getalpha(u->d2_handle);
x = 0 - t->target_layer->buf_area.x1;
y = 0 - t->target_layer->buf_area.y1;
@@ -384,6 +389,8 @@ static void dave2d_draw_border_complex(lv_draw_task_t * t, const lv_area_t * ori
d2_setantialiasing(u->d2_handle, aa); //restore original setting
}
d2_setalpha(u->d2_handle, current_alpha);
#if LV_USE_OS
status = lv_mutex_unlock(u->pd2Mutex);
LV_ASSERT(LV_RESULT_OK == status);
@@ -34,6 +34,7 @@ void lv_draw_dave2d_fill(lv_draw_task_t * t, const lv_draw_fill_dsc_t * dsc, con
lv_area_move(&draw_area, x, y);
lv_area_move(&coordinates, x, y);
d2_u8 current_alpha = d2_getalpha(u->d2_handle);
d2_framebuffer_from_layer(u->d2_handle, t->target_layer);
if(LV_GRAD_DIR_NONE != dsc->grad.dir) {
@@ -268,7 +269,7 @@ void lv_draw_dave2d_fill(lv_draw_task_t * t, const lv_draw_fill_dsc_t * dsc, con
LV_ASSERT(D2_OK == result);
result = d2_renderbox(u->d2_handle,
(d2_width)D2_FIX4(coordinates.x2 - radius),
(d2_width)D2_FIX4(coordinates.x2 - radius + 1),
(d2_width)D2_FIX4(coordinates.y1 + radius),
(d2_width)D2_FIX4(radius),
(d2_width)D2_FIX4(lv_area_get_height(&coordinates) - (2 * radius)));
@@ -280,6 +281,9 @@ void lv_draw_dave2d_fill(lv_draw_task_t * t, const lv_draw_fill_dsc_t * dsc, con
d2_setalphamode(u->d2_handle, current_alpha_mode);
d2_setfillmode(u->d2_handle, d2_fm_color); //default
}
else {
d2_setalpha(u->d2_handle, current_alpha);
}
#if LV_USE_OS
status = lv_mutex_unlock(u->pd2Mutex);
@@ -83,6 +83,8 @@ static void img_draw_core(lv_draw_task_t * t, const lv_draw_image_dsc_t * draw_d
d2_u8 current_fill_mode;
d2_u32 src_blend_mode;
d2_u32 dst_blend_mode;
d2_u32 src_alpha_blend_mode;
d2_u32 dst_alpha_blend_mode;
void * p_intermediate_buf = NULL;
#if LV_USE_OS
@@ -91,6 +93,9 @@ static void img_draw_core(lv_draw_task_t * t, const lv_draw_image_dsc_t * draw_d
LV_ASSERT(LV_RESULT_OK == status);
#endif
src_alpha_blend_mode = d2_getalphablendmodesrc(u->d2_handle);
dst_alpha_blend_mode = d2_getalphablendmodedst(u->d2_handle);
buffer_area = t->target_layer->buf_area;
draw_area = *img_coords;
clipped_area = *clipped_img_area;
@@ -209,7 +214,7 @@ static void img_draw_core(lv_draw_task_t * t, const lv_draw_image_dsc_t * draw_d
d2_settextureoperation(u->d2_handle, d2_to_replace, d2_to_copy, d2_to_copy, d2_to_copy);
}
else { //Formats with an alpha channel,
d2_settextureoperation(u->d2_handle, d2_to_copy, d2_to_copy, d2_to_copy, d2_to_copy);
d2_settextureoperation(u->d2_handle, d2_to_multiply, d2_to_copy, d2_to_copy, d2_to_copy);
}
if(LV_BLEND_MODE_NORMAL == draw_dsc->blend_mode) { /**< Simply mix according to the opacity value*/
@@ -300,6 +305,7 @@ static void img_draw_core(lv_draw_task_t * t, const lv_draw_image_dsc_t * draw_d
d2_setfillmode(u->d2_handle, current_fill_mode);
d2_settextureoperation(u->d2_handle, a_texture_op, r_texture_op, g_texture_op, b_texture_op);
d2_setblendmode(u->d2_handle, src_blend_mode, dst_blend_mode);
d2_setalphablendmode(u->d2_handle, src_alpha_blend_mode, dst_alpha_blend_mode);
if(NULL != p_intermediate_buf) {
lv_free(p_intermediate_buf);
@@ -32,6 +32,8 @@ void lv_draw_dave2d_line(lv_draw_task_t * t, const lv_draw_line_dsc_t * dsc)
LV_ASSERT(LV_RESULT_OK == status);
#endif
d2_u8 current_alpha = d2_getalpha(u->d2_handle);
buffer_area = t->target_layer->buf_area;
p1_x = dsc->p1.x - buffer_area.x1;
p1_y = dsc->p1.y - buffer_area.y1;
@@ -69,6 +71,7 @@ void lv_draw_dave2d_line(lv_draw_task_t * t, const lv_draw_line_dsc_t * dsc)
d2_renderline(u->d2_handle, D2_FIX4(p1_x), D2_FIX4(p1_y), D2_FIX4(p2_x),
D2_FIX4(p2_y), D2_FIX4(dsc->width), d2_le_exclude_none);
d2_setalpha(u->d2_handle, current_alpha);
#if LV_USE_OS
status = lv_mutex_unlock(u->pd2Mutex);
LV_ASSERT(LV_RESULT_OK == status);
@@ -86,6 +86,7 @@ void lv_draw_dave2d_triangle(lv_draw_task_t * t, const lv_draw_triangle_dsc_t *
p[1].y -= 1;
p[2].y -= 1;
d2_u8 current_alpha = d2_getalpha(u->d2_handle);
current_alpha_mode = d2_getalphamode(u->d2_handle);
if(LV_GRAD_DIR_NONE != dsc->grad.dir) {
@@ -149,6 +150,7 @@ void lv_draw_dave2d_triangle(lv_draw_task_t * t, const lv_draw_triangle_dsc_t *
flags);
d2_setalphamode(u->d2_handle, current_alpha_mode);
d2_setalpha(u->d2_handle, current_alpha);
#if LV_USE_OS
status = lv_mutex_unlock(u->pd2Mutex);