diff --git a/Kconfig b/Kconfig index 8c150e8fb..649d5dce7 100644 --- a/Kconfig +++ b/Kconfig @@ -269,6 +269,12 @@ menu "LVGL configuration" default y depends on LV_USE_DRAW_SW + config LV_DRAW_SW_I1_LUM_THRESHOLD + int "Luminance threshold for a pixel to be active" + default 127 + range 0 254 + depends on LV_DRAW_SW_SUPPORT_I1 + config LV_DRAW_SW_DRAW_UNIT_CNT int "Number of draw units" default 1 diff --git a/lv_conf_template.h b/lv_conf_template.h index d604e034d..a9c902c2b 100644 --- a/lv_conf_template.h +++ b/lv_conf_template.h @@ -174,6 +174,10 @@ #define LV_DRAW_SW_SUPPORT_A8 1 #define LV_DRAW_SW_SUPPORT_I1 1 + /* The threshold of the luminance to consider a pixel as + * active in indexed color format */ + #define LV_DRAW_SW_I1_LUM_THRESHOLD 127 + /** Set number of draw units. * - > 1 requires operating system to be enabled in `LV_USE_OS`. * - > 1 means multiple threads will render the screen in parallel. */ diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_i1.c b/src/draw/sw/blend/lv_draw_sw_blend_to_i1.c index 1fd19c3e7..829acecd0 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_i1.c +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_i1.c @@ -82,7 +82,7 @@ static inline void * /* LV_ATTRIBUTE_FAST_MEM */ drawbuf_next_row(const void * b * MACROS **********************/ -#define I1_LUM_THRESHOLD 127 +#define I1_LUM_THRESHOLD LV_DRAW_SW_I1_LUM_THRESHOLD #ifndef LV_DRAW_SW_I1_BLEND_NORMAL_TO_I1 #define LV_DRAW_SW_I1_BLEND_NORMAL_TO_I1(...) LV_RESULT_INVALID diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h index 6d74f81a9..1f810ac0b 100644 --- a/src/lv_conf_internal.h +++ b/src/lv_conf_internal.h @@ -500,6 +500,16 @@ #endif #endif + /* The threshold of the luminance to consider a pixel as + * active in indexed color format */ + #ifndef LV_DRAW_SW_I1_LUM_THRESHOLD + #ifdef CONFIG_LV_DRAW_SW_I1_LUM_THRESHOLD + #define LV_DRAW_SW_I1_LUM_THRESHOLD CONFIG_LV_DRAW_SW_I1_LUM_THRESHOLD + #else + #define LV_DRAW_SW_I1_LUM_THRESHOLD 127 + #endif + #endif + /** Set number of draw units. * - > 1 requires operating system to be enabled in `LV_USE_OS`. * - > 1 means multiple threads will render the screen in parallel. */